linksvilla.blogg.se

Gideros scene manager
Gideros scene manager




gideros scene manager

On exitEnd, we've been transitioned away from, and we can removeChild any sprites we created (or let them be garbage collected eventually). You shouldn't respond to UI touches during a transition. This is the parallel to enterEnd, so this is where I unhook all my event handlers. On exitBegin, we're about to transition away. After your transition is done, then respond to events. On enterEnd, is where I found it best to add the event listeners for touch, mouse, ENTER_FRAME, etc. You want them there to be visible during the transition. If you're about to be transitioned into, that's a good time to add things to self. Your Scene is a sprite and should just add objects to self in the :init() method. The Scenes themselves are really Sprites, that get addChild'd to the SceneManager object (a Sprite itself), and removed when transitioned from. I expected to be able to have Scene objects initially created, then notified when a transition is occurring, that they could retain their state between scene changes.įor some Scenes it may make sense to build/destroy them on every transition, but for the core gameplay scene, for example, destroying it and rebuilding it on every transition to or from it, is awkward and inefficient at times. Scene1 is kept around by reference until it is replaced by Scene2 as the "from" Scene (I think). The latter seems to be the case from what I've seen in the code, it creates a new Scene2 each time you switch to Scene2. I thought each scene would have the ability to be persistent, and switched between, pausing and unpausing but not being destroyed and reinstantiated on scene changes. I share some of your confusion about the SceneManager.






Gideros scene manager