I don’t understand what should go in the create listener function and what should go in the show listener function. Where should the images and objects of the game be? Where should you insert into sceneGroup? What about the physics and tap/enterFrame listeners (main game loop)?
It is totally up to you.
Just understand when the different listeners are called and decide how you want to use that knowledge.
I’m assuming you’ve read the guides. If not, please do:
Read this: https://docs.coronalabs.com/guide/system/composer/index.html
Pay attention to this to understand when listeners are called: https://docs.coronalabs.com/guide/system/composer/index.html#scene-flowevents
In general, fixed images in the scene: backgrounds, UI elements, objects that exist at fixed points (or platforms that may move, but stay in their general area), etc. should be done in scene:create(). If you’re adding physics bodies, you will need to start physics, but I recommend immediately pausing physics. The scene is not visible and starting anything in motion here will move before the scene transitions on screen.
scene:show()'s “will” phase is a great place to reposition objects that may have moved if you’re re-entering the scene. The scene is still not on the screen, so it’s a good time to reposition things. But you don’t want to start movement because things could fall before the on-screen transition completes.
scene:show()'s “did” phase is where you should resume physics that you paused earlier. You can start any enterFrame listeners, timers, transitions, background audio, enemy spawning etc. here. At this point the scene is fully on screen, so it’s safe to “start” things.
Rob
It is totally up to you.
Just understand when the different listeners are called and decide how you want to use that knowledge.
I’m assuming you’ve read the guides. If not, please do:
Read this: https://docs.coronalabs.com/guide/system/composer/index.html
Pay attention to this to understand when listeners are called: https://docs.coronalabs.com/guide/system/composer/index.html#scene-flowevents
In general, fixed images in the scene: backgrounds, UI elements, objects that exist at fixed points (or platforms that may move, but stay in their general area), etc. should be done in scene:create(). If you’re adding physics bodies, you will need to start physics, but I recommend immediately pausing physics. The scene is not visible and starting anything in motion here will move before the scene transitions on screen.
scene:show()'s “will” phase is a great place to reposition objects that may have moved if you’re re-entering the scene. The scene is still not on the screen, so it’s a good time to reposition things. But you don’t want to start movement because things could fall before the on-screen transition completes.
scene:show()'s “did” phase is where you should resume physics that you paused earlier. You can start any enterFrame listeners, timers, transitions, background audio, enemy spawning etc. here. At this point the scene is fully on screen, so it’s safe to “start” things.
Rob