diff demos/shooter/scripts/ships/shipbase.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 4d0aa75a82f1
children 10aff123c62c
line wrap: on
line diff
--- a/demos/shooter/scripts/ships/shipbase.py	Wed Apr 14 19:15:27 2010 +0000
+++ b/demos/shooter/scripts/ships/shipbase.py	Thu Apr 15 15:53:06 2010 +0000
@@ -36,7 +36,13 @@
 		self._ship.instance.addActionListener(self)
 
 	def onInstanceActionFinished(self, instance, action):
-		pass
+		if action.getId() == 'flash':
+			if self._ship._flashing and self._ship._flashnumber > 0:
+				self._ship.instance.act('flash', self._ship.instance.getFacingLocation())
+				self._ship._flashnumber -= 1	
+			else:	
+				self._ship._flashing = False
+				self._ship._flashnumber = 0
 
 class Ship(SpaceObject):
 	def __init__(self, scene, name, findInstance=True):
@@ -64,7 +70,7 @@
 		self._flashing = True	
 	
 	def fire(self, direction):
-		if self._weapon:
+		if self._weapon and self._hitpoints > 0:
 			return self._weapon.fire(direction)
 		
 		return None