Mercurial > fife-parpg
comparison demos/shooter/scripts/ships/shipbase.py @ 492:16ceb3228324
Moved the SoundManager and the 2D math function (helpers) from the shooter demo to the fife extensions.
Fixed fife_timer as it didn't work in the first place. Modified the SoundManager to use the now working fife_timer and removed the Timer class from the shooter demo entirely
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Fri, 07 May 2010 21:07:27 +0000 |
parents | c4168eb47a44 |
children | e241d7553496 |
comparison
equal
deleted
inserted
replaced
491:c4168eb47a44 | 492:16ceb3228324 |
---|---|
84 self._flashing = False | 84 self._flashing = False |
85 | 85 |
86 self._hitpoints = 0 | 86 self._hitpoints = 0 |
87 self._scorevalue = 0 | 87 self._scorevalue = 0 |
88 | 88 |
89 self._hitclip = self._scene.soundmanager.loadSoundClip("sounds/hit.ogg") | 89 self._hitclip = self._scene.soundmanager.createSoundEmitter("sounds/hit.ogg") |
90 self._explodclip = self._scene.soundmanager.loadSoundClip("sounds/explode.ogg") | 90 self._explodclip = self._scene.soundmanager.createSoundEmitter("sounds/explode.ogg") |
91 | 91 |
92 def _setWeapon(self, weapon): | 92 def _setWeapon(self, weapon): |
93 self._weapon = weapon | 93 self._weapon = weapon |
94 | 94 |
95 def _getWeapon(self): | 95 def _getWeapon(self): |
125 """ | 125 """ |
126 self._hitpoints -= hp | 126 self._hitpoints -= hp |
127 if self._hitpoints <= 0: | 127 if self._hitpoints <= 0: |
128 self.destroy() | 128 self.destroy() |
129 else: | 129 else: |
130 self._scene.soundmanager.playClip(self._hitclip) | 130 self._hitclip.play() |
131 | 131 |
132 def destroy(self): | 132 def destroy(self): |
133 """ | 133 """ |
134 Plays the explode animation (or action) | 134 Plays the explode animation (or action) |
135 """ | 135 """ |
136 if self._running: | 136 if self._running: |
137 self._instance.act('explode', self._instance.getFacingLocation()) | 137 self._instance.act('explode', self._instance.getFacingLocation()) |
138 self._scene.soundmanager.playClip(self._explodclip) | 138 self._explodclip.play() |
139 super(Ship, self).destroy() | 139 super(Ship, self).destroy() |
140 | 140 |
141 def _getHitPoints(self): | 141 def _getHitPoints(self): |
142 return self._hitpoints | 142 return self._hitpoints |
143 | 143 |