Search the Community
Showing results for tags 'best-practice'.
Found 1 result
It has been a year since i last tried out PIXI and i wanted to use it in a new project but organizing my code a bit better (last year i used it for LD27 and the code was a bit of a mess). I tried the ezelia example, but with the update from the PIXI version used in the example to the latest one the mouse events did not work anymore. I tried the whole day to fix it, rewrote the example in pure JS but i still have the problem that once i switch from one stage to the other and then back (calling the renderer with the different stages), the mouse events of the first Stage do not work anymore, even when i reset them after the switch. Is there a best practice on how to deal with different views / Stages of an app? Lets say i have the intro screen, the game / app itself and a couple of other views with highscore / help and such things. How would one go about with the latest PIXI version while trying to keep the code organized? I thought it would make sense to initialize the views and then switch freely between them, but somehow i am missing something there (i guess there is a hierarchy problem or sth?) So is the way one should go about it to just have one stage at a time and destroy it after use, reinitializing when it is needed again? That does not seem to be very efficient. Or should everything go into one stage object which then has to handle all the different states of the game / app? That seems to be very cluttered and not easy to maintain?