What's the best way to just pause the game. Let's say the user has caused
the game to be over through some lose condition. I jsut want to pause all
the actions in the scene and layers, then throw up some info on a Sprite or
Label or whatehaveyou.
This is from the active layer and is called by a lose condition in one of
the game loops:
def endGame(self):
print 'GAME OVER MAN, GAME OVER!'
nextScene = cocos.scenes.pause.get_pause_scene()
nextScene.add(cocos.scenes.pause.PauseLayer())
director.push(nextScene)
BTW, this is the start.py script I have:
def init():
try:
director.init()
win = director.window
cursor = win.get_system_mouse_cursor(BaseWindow.CURSOR_CROSSHAIR)
win.set_mouse_cursor(cursor)
StartScene = cocos.scene.Scene()
StartScene.add(SpaceLayer())
# StartScene.add(PlanetLayer(GlobalVariables()))
# StartScene.add(CityLayer(GlobalVariables()))
# StartScene.add(BuildingLayer(GlobalVariables()))
director.run(StartScene)
except:
traceback.print_exc(file=sys.stdout)
pyglet.app.exit()
sys.exit()
The commented out bits are just to test the different layers. Each one is
put into a Scene object, then has the director push it out from the
previous layer. Both handleLaunchCraft and endGame are called from the
active layer.
def handleLaunchCraft(self):
if (self.currentPopnCenter != ''):
nextScene = cocos.scene.Scene()
nextScene.add(self.getNextLayer())
director.push(nextScene)
But then I get a PAUSE text up front, is there any way to override that?
Also, am I structuring this correctly?
Thanks,
J
--
You received this message because you are subscribed to the Google Groups
"cocos2d discuss" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/cocos-discuss/-/iZY2CgQosCwJ.
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.