comparison demos/shooter/scripts/ships/player.py @ 471:7a79dc2a0592

Adding the credits window (still needs to be written) Hopefully fixed some memory leaks. Moved the flashing code to the appropriate spot (in ShipBase).
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 15 Apr 2010 15:53:06 +0000
parents c4f745a566d6
children 10aff123c62c
comparison
equal deleted inserted replaced
470:3b04e921c93d 471:7a79dc2a0592
32 super(PlayerActionListener, self).__init__(ship) 32 super(PlayerActionListener, self).__init__(ship)
33 33
34 def onInstanceActionFinished(self, instance, action): 34 def onInstanceActionFinished(self, instance, action):
35 if action.getId() == 'explode': 35 if action.getId() == 'explode':
36 self._ship.respawn() 36 self._ship.respawn()
37 if action.getId() == 'flash': 37
38 if self._ship._flashnumber > 0: 38 super(PlayerActionListener, self).onInstanceActionFinished(instance, action)
39 self._ship.instance.act('flash', self._ship.instance.getFacingLocation())
40 self._ship._flashnumber -= 1
41 else:
42 self._ship._flashing = False
43 39
44 40
45 class Player(Ship): 41 class Player(Ship):
46 def __init__(self, scene, playerName): 42 def __init__(self, scene, playerName):
47 super(Player, self).__init__(scene, playerName) 43 super(Player, self).__init__(scene, playerName)
97 if not self._invulnerable and not self._dead: 93 if not self._invulnerable and not self._dead:
98 self._instance.act('explode', self._instance.getFacingLocation()) 94 self._instance.act('explode', self._instance.getFacingLocation())
99 self._dead = True 95 self._dead = True
100 self._invulnerable = True 96 self._invulnerable = True
101 self._lives -= 1 97 self._lives -= 1
98
99 def fire(self, direction):
100 return self._weapon.fire(direction)
102 101
103 def update(self): 102 def update(self):
104 103
105 key = False 104 key = False
106 105