diff demos/shooter/scripts/ships/shipbase.py @ 477:6b33d80b468b

Projectiles are now part of the scene. Cleaned up the scene update() function. Moved garbage collection to the beginning of the frame. Introduced global object types. Projectiles now only check for collisions in a limited number of scene nodes rather than the entire screen.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 22 Apr 2010 19:52:34 +0000
parents 10aff123c62c
children 82d44c471959
line wrap: on
line diff
--- a/demos/shooter/scripts/ships/shipbase.py	Thu Apr 22 01:18:44 2010 +0000
+++ b/demos/shooter/scripts/ships/shipbase.py	Thu Apr 22 19:52:34 2010 +0000
@@ -24,7 +24,7 @@
 from math import sqrt
 
 from fife import fife
-from scripts.common.baseobject import SpaceObject
+from scripts.common.baseobject import *
 from scripts.weapons import Weapon
 
 
@@ -44,7 +44,7 @@
 				self._ship._flashing = False
 				self._ship._flashnumber = 0
 		
-		if action.getId() == 'explode' and not self._ship.isplayer:
+		if action.getId() == 'explode' and not self._ship.type == SHTR_PLAYER:
 			self._ship.removeFromScene()
 
 class Ship(SpaceObject):
@@ -56,8 +56,6 @@
 		self._flashnumber = 0
 		self._flashing = False
 		
-		self._isplayer = False
-		
 		self._hitpoints = 0
 		self._scorevalue = 0
 	
@@ -89,10 +87,6 @@
 			self._instance.act('explode', self._instance.getFacingLocation())
 			super(Ship, self).destroy()
 	
-	def _isPlayer(self):
-		return self._isplayer
-	
-	
 	def _getHitPoints(self):
 		return self._hitpoints
 		
@@ -105,7 +99,6 @@
 	def _setScoreValue(self, value):
 		self._scorevalue = value
 	
-	isplayer = property(_isPlayer)
 	weapon = property(_getWeapon, _setWeapon)
 	hitpoints = property(_getHitPoints, _setHitPoints)
 	scorevalue = property(_getScoreValue, _setScoreValue)
\ No newline at end of file