Mercurial > fife-parpg
comparison demos/shooter/scripts/weapons.py @ 490:939a4dc12ca1
Starting to add some comments.
Cleaned up some old commented out code.
The SoundManager now creates a new SoundClip rather than only creating one per FIFE SoundEmitter.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Wed, 05 May 2010 21:39:31 +0000 |
parents | 82d44c471959 |
children | c4168eb47a44 |
comparison
equal
deleted
inserted
replaced
489:0324a3533988 | 490:939a4dc12ca1 |
---|---|
25 from scripts.common.baseobject import * | 25 from scripts.common.baseobject import * |
26 from scripts.common.helpers import normalize, rotatePoint | 26 from scripts.common.helpers import normalize, rotatePoint |
27 from scripts.soundmanager import * | 27 from scripts.soundmanager import * |
28 | 28 |
29 class Projectile(SpaceObject): | 29 class Projectile(SpaceObject): |
30 """ | |
31 Projectile | |
32 | |
33 This is the entity that weapons fire. Projectiles have an owner | |
34 and a time to live. They are also what cause damage to ships | |
35 and other entities. | |
36 """ | |
30 def __init__(self, scene, owner, projectileName, timeToLive): | 37 def __init__(self, scene, owner, projectileName, timeToLive): |
31 super(Projectile, self).__init__(scene, projectileName, False) | 38 super(Projectile, self).__init__(scene, projectileName, False) |
32 | 39 |
33 self._obj = self._model.getObject(self._name, "http://www.fifengine.de/xml/tutorial") | 40 self._obj = self._model.getObject(self._name, "http://www.fifengine.de/xml/tutorial") |
34 | 41 |
83 ttl = property(_getTTL) | 90 ttl = property(_getTTL) |
84 owner = property(_getOwner) | 91 owner = property(_getOwner) |
85 damage = property(_getDamage, _setDamage) | 92 damage = property(_getDamage, _setDamage) |
86 | 93 |
87 class Weapon(object): | 94 class Weapon(object): |
95 """ | |
96 Weapon | |
97 | |
98 This class is a super class and is meant to be inherited and | |
99 not used directly. You should implement fire() in the sub- | |
100 class. The Weapon class spawns Projectile(s) and fires them | |
101 in the specified direction at a specified fire rate. | |
102 """ | |
88 def __init__(self, scene, ship, firerate): | 103 def __init__(self, scene, ship, firerate): |
89 self._scene = scene | 104 self._scene = scene |
90 self._model = self._scene.model | 105 self._model = self._scene.model |
91 self._layer = self._scene.objectlayer | 106 self._layer = self._scene.objectlayer |
92 self._ship = ship | 107 self._ship = ship |