Mercurial > fife-parpg
comparison demos/shooter/scripts/world.py @ 457:597b066d5ccb
Player now has 3 lives and will receive a game over message once they are used up.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Thu, 08 Apr 2010 21:18:36 +0000 |
parents | 41fd97da94d1 |
children | 5e1d6e40d19d |
comparison
equal
deleted
inserted
replaced
456:41fd97da94d1 | 457:597b066d5ccb |
---|---|
68 self.showMainMenu() | 68 self.showMainMenu() |
69 | 69 |
70 self._hudwindow = HeadsUpDisplay(self) | 70 self._hudwindow = HeadsUpDisplay(self) |
71 self._hudwindow.hide() | 71 self._hudwindow.hide() |
72 | 72 |
73 self._gameover = GameOverDisplay() | |
74 self._gameover.hide() | |
73 | 75 |
74 def showMainMenu(self): | 76 def showMainMenu(self): |
75 if self.scene: | 77 if self.scene: |
76 self._paused = True | 78 self._paused = True |
77 cont = True | 79 cont = True |
105 """ | 107 """ |
106 self.filename = filename | 108 self.filename = filename |
107 self.reset() | 109 self.reset() |
108 self.map = loadMapFile(self.filename, self.engine) | 110 self.map = loadMapFile(self.filename, self.engine) |
109 | 111 |
110 self.scene = Scene(self.engine, self.map.getLayer('objects')) | 112 self.scene = Scene(self, self.engine, self.map.getLayer('objects')) |
111 self.scene.initScene(self.map) | 113 self.scene.initScene(self.map) |
112 | 114 |
113 self.initCameras() | 115 self.initCameras() |
114 | 116 |
115 self._hudwindow.show() | 117 self._hudwindow.show() |
118 self._gameover.hide() | |
116 | 119 |
117 self._starttime = self.timemanager.getTime() | 120 self._starttime = self.timemanager.getTime() |
118 | 121 |
122 def gameOver(self): | |
123 self._gameover.show() | |
119 | 124 |
120 def newGame(self): | 125 def newGame(self): |
121 self.loadLevel("maps/shooter_map1.xml") | 126 self.loadLevel("maps/shooter_map1.xml") |
122 self._mainmenu.hide() | 127 self._mainmenu.hide() |
123 self._paused = False | 128 self._paused = False |
224 self._hudwindow.setVelocityText(unicode(vel)) | 229 self._hudwindow.setVelocityText(unicode(vel)) |
225 | 230 |
226 score = unicode(str(player.score)) | 231 score = unicode(str(player.score)) |
227 self._hudwindow.setScoreText(score) | 232 self._hudwindow.setScoreText(score) |
228 | 233 |
234 lives = unicode(str(player.lives)) | |
235 self._hudwindow.setLivesText(lives) | |
236 | |
229 else: | 237 else: |
230 if not self.scene.paused: | 238 if not self.scene.paused: |
231 self.scene.pause(self.timemanager.getTime() - self._starttime) | 239 self.scene.pause(self.timemanager.getTime() - self._starttime) |
232 | 240 |
233 self.pump_ctr += 1 | 241 self.pump_ctr += 1 |