Mercurial > fife-parpg
comparison demos/shooter/scripts/ships/player.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 | afde89c1d50b |
children | ab28994820dd |
comparison
equal
deleted
inserted
replaced
476:78a1eb57c074 | 477:6b33d80b468b |
---|---|
20 # Free Software Foundation, Inc., | 20 # Free Software Foundation, Inc., |
21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | 21 # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
22 # #################################################################### | 22 # #################################################################### |
23 | 23 |
24 from fife import fife | 24 from fife import fife |
25 from scripts.common.baseobject import * | |
25 from scripts.ships.shipbase import * | 26 from scripts.ships.shipbase import * |
26 from scripts.common.helpers import * | 27 from scripts.common.helpers import * |
27 from scripts.weapons import * | 28 from scripts.weapons import * |
28 | 29 |
29 | 30 |
41 | 42 |
42 class Player(Ship): | 43 class Player(Ship): |
43 def __init__(self, scene, playerName): | 44 def __init__(self, scene, playerName): |
44 super(Player, self).__init__(scene, playerName) | 45 super(Player, self).__init__(scene, playerName) |
45 | 46 |
47 self._type = SHTR_PLAYER | |
48 | |
46 self._score = 0 | 49 self._score = 0 |
47 self._maxvelocity = 1.5 | 50 self._maxvelocity = 1.5 |
48 self._acceleration = 1.0 | 51 self._acceleration = 1.0 |
49 | 52 |
50 self.width = 0.22 | 53 self.width = 0.22 |
51 self.height = 0.12 | 54 self.height = 0.12 |
52 | |
53 self._isplayer = True | |
54 | 55 |
55 self._actionlistener = PlayerActionListener(self) | 56 self._actionlistener = PlayerActionListener(self) |
56 | 57 |
57 self._lives = 3 | 58 self._lives = 3 |
58 self.init() | 59 self.init() |