Mercurial > fife-parpg
comparison demos/shooter/scripts/scene.py @ 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 |
comparison
equal
deleted
inserted
replaced
457:597b066d5ccb | 458:e77ebf128a74 |
---|---|
114 def playerDied(self): | 114 def playerDied(self): |
115 self._player.destroy() | 115 self._player.destroy() |
116 if self._player.lives <= -1: | 116 if self._player.lives <= -1: |
117 self._gameover = True | 117 self._gameover = True |
118 self._world.gameOver() | 118 self._world.gameOver() |
119 self.removeAllProjectiles() | |
119 return | 120 return |
120 | 121 |
121 #TODO: Have to find a better way to do this. If the player | 122 #TODO: Have to find a better way to do this. If the player |
122 #dies too many times right at the start of the level he will | 123 #dies too many times right at the start of the level he will |
123 #get pushed past the edge of the map to the left. | 124 #get pushed past the edge of the map to the left. |
127 pos.x -= 5 | 128 pos.x -= 5 |
128 oldpos.setExactLayerCoordinates(pos) | 129 oldpos.setExactLayerCoordinates(pos) |
129 self._player.location = oldpos | 130 self._player.location = oldpos |
130 self._camera.setLocation(self._player.location) | 131 self._camera.setLocation(self._player.location) |
131 | 132 |
133 self.removeAllProjectiles() | |
134 | |
135 def removeAllProjectiles(self): | |
132 projtodelete = list() | 136 projtodelete = list() |
133 for p in self._projectiles: | 137 for p in self._projectiles: |
134 p.destroy() | 138 p.destroy() |
135 projtodelete.append(p) | 139 projtodelete.append(p) |
136 | 140 |
137 for p in projtodelete: | 141 for p in projtodelete: |
138 self._projectiles.remove(p) | 142 self._projectiles.remove(p) |
139 | |
140 print len(self._projectiles) | |
141 | 143 |
142 def gameOver(self): | 144 def gameOver(self): |
143 self._world.gameOver() | 145 self._world.gameOver() |
144 | 146 |
145 def getObjectsInNode(self, nodeindex): | 147 def getObjectsInNode(self, nodeindex): |