diff demos/shooter/scripts/ships/enemies.py @ 453:cf53848fb187

Scene now gets updated when an object moves from one node to another. Player is now part of the scene. Projectiles can be files by both player and enemies. Some code cleanup.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Tue, 06 Apr 2010 19:12:41 +0000
parents f07d779362da
children bd7e8f708adf
line wrap: on
line diff
--- a/demos/shooter/scripts/ships/enemies.py	Sat Apr 03 19:19:33 2010 +0000
+++ b/demos/shooter/scripts/ships/enemies.py	Tue Apr 06 19:12:41 2010 +0000
@@ -28,13 +28,15 @@
 
 
 class Saucer1(Ship):
-	def __init__(self, model, name, layer, findInstance=True):
-		super(Saucer1, self).__init__(model, name, layer, findInstance)
+	def __init__(self, scene, name, findInstance=True):
+		super(Saucer1, self).__init__(scene, name, findInstance)
 		self._dir = 0
 		self._time = 500
 		self.width = 0.075
 		self.height = 0.075
 		self.velocity.x = -0.5
+		
+		self.weapon = Weapon(self._scene, self, 1000)
 				
 	def update(self, timedelta):	
 		if self._dir == 1:
@@ -55,13 +57,15 @@
 		super(Saucer1, self).update(timedelta)
 		
 class Saucer2(Ship):
-	def __init__(self, model, name, layer, findInstance=True):
-		super(Saucer2, self).__init__(model, name, layer, findInstance)
+	def __init__(self, scene, name, findInstance=True):
+		super(Saucer2, self).__init__(scene, name, findInstance)
 		self._dir = 0
 		self._time = 1000
 		self.width = 0.2
 		self.height = 0.2
 		self.velocity.x = -0.1
+		
+		self.weapon = Weapon(self._scene, self, 2000)
 				
 	def update(self, timedelta):	
 		if self._dir == 1: