comparison demos/shooter/scripts/ships/player.py @ 450:ba6817013343

Added score keeping ability. Some misc cleanup. Fixed the bounding box. Enemies are now removed from the scene when they are destroyed.
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Thu, 01 Apr 2010 19:26:56 +0000
parents 1cf56403347a
children f463ab431cc0
comparison
equal deleted inserted replaced
449:1cf56403347a 450:ba6817013343
28 28
29 class Player(Ship): 29 class Player(Ship):
30 def __init__(self, model, playerName, layer): 30 def __init__(self, model, playerName, layer):
31 super(Player, self).__init__(model, playerName, layer) 31 super(Player, self).__init__(model, playerName, layer)
32 self._bounds = Rect(-100,-100,200,200) 32 self._bounds = Rect(-100,-100,200,200)
33 self._score = 0
34
35 def _getScore(self):
36 return self._score
33 37
38 def applyScore(self, sc):
39 self._score += sc
40
34 def update(self, timedelta, keystate, camera): 41 def update(self, timedelta, keystate, camera):
35 key = False 42 key = False
36 43
37 oldpos = self.location 44 oldpos = self.location
38 45
95 102
96 103
97 104
98 self.location = oldpos 105 self.location = oldpos
99 106
107
108 score = property(_getScore)