changeset 458:e77ebf128a74

Fixed a small bug where projectiles are not updated when it is game over.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 08 Apr 2010 21:26:46 +0000
parents 597b066d5ccb
children 302a69c5141d
files demos/shooter/scripts/scene.py
diffstat 1 files changed, 5 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/demos/shooter/scripts/scene.py	Thu Apr 08 21:18:36 2010 +0000
+++ b/demos/shooter/scripts/scene.py	Thu Apr 08 21:26:46 2010 +0000
@@ -116,6 +116,7 @@
 		if self._player.lives <= -1:
 			self._gameover = True
 			self._world.gameOver()
+			self.removeAllProjectiles()
 			return
 		
 		#TODO: Have to find a better way to do this.  If the player
@@ -129,15 +130,16 @@
 		self._player.location = oldpos
 		self._camera.setLocation(self._player.location)
 		
+		self.removeAllProjectiles()
+		
+	def removeAllProjectiles(self):
 		projtodelete = list()
 		for p in self._projectiles:
 			p.destroy()
 			projtodelete.append(p)
 			
 		for p in projtodelete:
-			self._projectiles.remove(p)
-			
-		print len(self._projectiles)
+			self._projectiles.remove(p)		
 		
 	def gameOver(self):
 		self._world.gameOver()