diff 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
line wrap: on
line diff
--- a/demos/shooter/scripts/world.py	Wed Apr 07 21:26:26 2010 +0000
+++ b/demos/shooter/scripts/world.py	Thu Apr 08 21:18:36 2010 +0000
@@ -70,6 +70,8 @@
 		self._hudwindow = HeadsUpDisplay(self)
 		self._hudwindow.hide()
 
+		self._gameover = GameOverDisplay()
+		self._gameover.hide()		
 	
 	def showMainMenu(self):
 		if self.scene:
@@ -107,15 +109,18 @@
 		self.reset()
 		self.map = loadMapFile(self.filename, self.engine)
 
-		self.scene = Scene(self.engine, self.map.getLayer('objects'))
+		self.scene = Scene(self, self.engine, self.map.getLayer('objects'))
 		self.scene.initScene(self.map)
 
 		self.initCameras()
 
 		self._hudwindow.show()
+		self._gameover.hide()
 		
 		self._starttime = self.timemanager.getTime()
-		
+
+	def gameOver(self):
+		self._gameover.show()
 
 	def newGame(self):
 		self.loadLevel("maps/shooter_map1.xml")
@@ -226,6 +231,9 @@
 			score = unicode(str(player.score))
 			self._hudwindow.setScoreText(score)
 			
+			lives = unicode(str(player.lives))
+			self._hudwindow.setLivesText(lives)
+			
 		else:
 			if not self.scene.paused:
 				self.scene.pause(self.timemanager.getTime() - self._starttime)