comparison demos/shooter/scripts/ships/player.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 e686b82d93d0
children 302a69c5141d
comparison
equal deleted inserted replaced
456:41fd97da94d1 457:597b066d5ccb
37 #give player the default weapon (the cannon) 37 #give player the default weapon (the cannon)
38 self.weapon = Cannon(self._scene, self, 200) 38 self.weapon = Cannon(self._scene, self, 200)
39 39
40 self._lives = 3 40 self._lives = 3
41 41
42 def init(self):
43 self._lives = 3
44
42 def _getScore(self): 45 def _getScore(self):
43 return self._score 46 return self._score
44 47
45 def applyScore(self, sc): 48 def applyScore(self, sc):
46 self._score += sc 49 self._score += sc
47 50
48 def destroy(self): 51 def destroy(self):
49 self._lives -= 1 52 self._lives -= 1
50 print "player has been destroyed!" 53
54 if self._lives < 0:
55 self._lives = -1
56
51 57
52 def update(self): 58 def update(self):
59
53 key = False 60 key = False
54 61
55 oldpos = self.location 62 oldpos = self.location
56 63
57 if self._scene.keystate['UP']: 64 if self._scene.keystate['UP']: