Mercurial > fife-parpg
comparison demos/shooter/scripts/ships/shipbase.py @ 474:10aff123c62c
Some minor code cleanups.
Changed the player ship controls a little to feel more natural.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Wed, 21 Apr 2010 16:49:59 +0000 |
parents | 7a79dc2a0592 |
children | 6b33d80b468b |
comparison
equal
deleted
inserted
replaced
473:b78020d31186 | 474:10aff123c62c |
---|---|
41 self._ship.instance.act('flash', self._ship.instance.getFacingLocation()) | 41 self._ship.instance.act('flash', self._ship.instance.getFacingLocation()) |
42 self._ship._flashnumber -= 1 | 42 self._ship._flashnumber -= 1 |
43 else: | 43 else: |
44 self._ship._flashing = False | 44 self._ship._flashing = False |
45 self._ship._flashnumber = 0 | 45 self._ship._flashnumber = 0 |
46 | |
47 if action.getId() == 'explode' and not self._ship.isplayer: | |
48 self._ship.removeFromScene() | |
46 | 49 |
47 class Ship(SpaceObject): | 50 class Ship(SpaceObject): |
48 def __init__(self, scene, name, findInstance=True): | 51 def __init__(self, scene, name, findInstance=True): |
49 super(Ship, self).__init__(scene, name, findInstance) | 52 super(Ship, self).__init__(scene, name, findInstance) |
50 | 53 |
63 | 66 |
64 def _getWeapon(self): | 67 def _getWeapon(self): |
65 return self._weapon | 68 return self._weapon |
66 | 69 |
67 def flash(self, number): | 70 def flash(self, number): |
68 self._instance.act('flash', self._instance.getFacingLocation()) | 71 if self._running: |
69 self._flashnumber = number | 72 self._instance.act('flash', self._instance.getFacingLocation()) |
70 self._flashing = True | 73 self._flashnumber = number |
74 self._flashing = True | |
71 | 75 |
72 def fire(self, direction): | 76 def fire(self, direction): |
73 if self._weapon and self._hitpoints > 0: | 77 if self._weapon and self._hitpoints > 0: |
74 return self._weapon.fire(direction) | 78 return self._weapon.fire(direction) |
75 | 79 |