Mercurial > fife-parpg
comparison demos/shooter/scripts/weapons.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 | 3b04e921c93d |
children | 3164715a0621 |
comparison
equal
deleted
inserted
replaced
470:3b04e921c93d | 471:7a79dc2a0592 |
---|---|
56 self._running = True | 56 self._running = True |
57 | 57 |
58 self._starttime = self._scene.time | 58 self._starttime = self._scene.time |
59 | 59 |
60 def destroy(self): | 60 def destroy(self): |
61 if self._running and self._instance: | 61 if self._instance: |
62 self._layer.deleteInstance(self._instance) | 62 self._layer.deleteInstance(self._instance) |
63 self._running = False | 63 self._instance = None |
64 | |
65 self._running = False | |
64 | 66 |
65 def _getTTL(self): | 67 def _getTTL(self): |
66 return self._ttl | 68 return self._ttl |
67 | 69 |
68 def _getOwner(self): | 70 def _getOwner(self): |
108 | 110 |
109 class Cannon(Weapon): | 111 class Cannon(Weapon): |
110 def __init__(self, scene, ship, firerate): | 112 def __init__(self, scene, ship, firerate): |
111 super(Cannon, self).__init__(scene, ship, firerate) | 113 super(Cannon, self).__init__(scene, ship, firerate) |
112 | 114 |
113 #cannon's projectile velocity | |
114 self._projectileVelocity = 0.75 | 115 self._projectileVelocity = 0.75 |
115 | 116 |
116 | 117 |
117 def fire(self, direction): | 118 def fire(self, direction): |
118 velocity = normalize(direction) | 119 velocity = normalize(direction) |
127 | 128 |
128 class FireBall(Weapon): | 129 class FireBall(Weapon): |
129 def __init__(self, scene, ship, firerate): | 130 def __init__(self, scene, ship, firerate): |
130 super(FireBall, self).__init__(scene, ship, firerate) | 131 super(FireBall, self).__init__(scene, ship, firerate) |
131 | 132 |
132 #cannon's projectile velocity | |
133 self._projectileVelocity = 0.50 | 133 self._projectileVelocity = 0.50 |
134 | 134 |
135 | 135 |
136 def fire(self, direction): | 136 def fire(self, direction): |
137 velocity = normalize(direction) | 137 velocity = normalize(direction) |