diff demos/shooter/scripts/ships/enemies.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
line wrap: on
line diff
--- a/demos/shooter/scripts/ships/enemies.py	Wed Apr 14 19:15:27 2010 +0000
+++ b/demos/shooter/scripts/ships/enemies.py	Thu Apr 15 15:53:06 2010 +0000
@@ -34,6 +34,8 @@
 	def onInstanceActionFinished(self, instance, action):
 		if action.getId() == 'explode':
 			self._ship.removeFromScene()
+			
+		super(EnemyActionListener, self).onInstanceActionFinished(instance, action)
 
 class BossActionListener(ShipActionListener):
 	def __init__(self, ship):
@@ -43,12 +45,9 @@
 		if action.getId() == 'explode':
 			self._ship.removeFromScene()
 			self._ship.endLevel()
-		elif action.getId() == 'flash':
-			if self._ship._flashnumber > 0:
-				self._ship.instance.act('flash', self._ship.instance.getFacingLocation())
-				self._ship._flashnumber -= 1	
-			else:	
-				self._ship._flashing = False
+		
+		super(BossActionListener, self).onInstanceActionFinished(instance, action)
+
 				
 class Saucer1(Ship):
 	def __init__(self, scene, name, instance, findInstance=True):
@@ -107,7 +106,10 @@
 		self.hitpoints = 2
 		self.scorevalue = 100
 
-				
+	def applyHit(self, hp):
+		self.flash(1)
+		super(Saucer2, self).applyHit(hp)
+		
 	def update(self):	
 		if self._dir == 1:
 			self.applyThrust(fife.DoublePoint(0,-0.25))
@@ -171,6 +173,10 @@
 		
 		self.hitpoints = 2
 		self.scorevalue = 150
+
+	def applyHit(self, hp):
+		self.flash(1)
+		super(Streaker, self).applyHit(hp)
 		
 	def update(self):	
 		self.applyThrust(fife.DoublePoint(-0.40,0))