I would be more in a case with several levels, so, a scene per level. here is a code http://pastebin.com/kc4PLGC0
If I click, the event will be receive by layer1 and my first sprite. I get the following output [Layer1] on_mouse_press [MySprite] on_mouse_press 1 then, it replaces the scene. if I click again, I get [Layer2] on_mouse_press [MySprite] on_mouse_press 2 [MySprite] on_mouse_press 1 The event it still handled by the sprite from scene1. layer1 behave well. Only issue with the sprite. By the way, I always post the samples (if too long) to pastebin, is it find ? do people prefer that we post everything in the message ? On Feb 28, 8:55 pm, claudio canepa <[email protected]> wrote: > On Tue, Feb 28, 2012 at 12:58 PM, Philippe <[email protected]> wrote: > > Hello, > > > When I have several scene in cocos. > > Should I create all of them at start, if possible, and simply play > > with the director.replace() ? > > Or is it recommanded to create a scene when needed, destroy it when > > pushing a new one, and the re-create it if necessary ? > > The typical game has some light scenes (menu options, etc) and one heavy > scene, the game scene. There, I would use the style with simpler code, > which usually means create when needed and don't care if some scene is in > the stack. > A common case is a main menu scene that pushes the game scene. > > > I used to create them all at start. But, then, even if a new scene is > > running, another one receives the mouse event (layers or sprites). > > That is not expected behavior I would think your code misses to call super > for the on_exit event on some node. > Can you post some code ? > > > Thanks! > > Philippe > > claudio > > -- -- You received this message because you are subscribed to the Google Groups "cocos2d discuss" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/cocos-discuss?hl=en.
