On Fri, Oct 19, 2012 at 5:11 PM, Jason <[email protected]> wrote:
> I'm working a game that pushes scenes onto the stack. So you are going
> from one level to the next. At a certain point, the game will bring the
> player back through these levels.
>
> However, when you press ESC, it pops the current scene out of the stack,
> and starts running the previous one. Is there any way for me to stop that?
>
> Cheers,
> J
> --
>
Yes.
Most surely you have an on_key_press handler in your scene (be it directly
in the scene or in a layer added to the scene)
what you want is add in that handler
if symbol == key.ESCAPE:
return True
The return True tells the event dispatcher that the event has been handled
and to please do not pass to other handlers. Perfect, the ESC will not
reach the code in cocos.director.DefaultHandler, the responsible to call
director pop when it sees an ESC.
--
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.