Mercurial > fife-parpg
comparison demos/shooter/scripts/ships/shipbase.py @ 483:82d44c471959
Modified the SoundManager to not create unique FIFE sound emitters for each object. There is now only one FIFE emitter per unique sound.
Added some sound effects.
author | prock@33b003aa-7bff-0310-803a-e67f0ece8222 |
---|---|
date | Thu, 29 Apr 2010 16:09:56 +0000 |
parents | 6b33d80b468b |
children | c4168eb47a44 |
comparison
equal
deleted
inserted
replaced
482:16c2b3ee59ce | 483:82d44c471959 |
---|---|
56 self._flashnumber = 0 | 56 self._flashnumber = 0 |
57 self._flashing = False | 57 self._flashing = False |
58 | 58 |
59 self._hitpoints = 0 | 59 self._hitpoints = 0 |
60 self._scorevalue = 0 | 60 self._scorevalue = 0 |
61 | |
62 self._hitclip = self._scene.soundmanager.loadSoundClip("sounds/hit.ogg") | |
63 self._explodclip = self._scene.soundmanager.loadSoundClip("sounds/explode.ogg") | |
61 | 64 |
62 def _setWeapon(self, weapon): | 65 def _setWeapon(self, weapon): |
63 self._weapon = weapon | 66 self._weapon = weapon |
64 | 67 |
65 def _getWeapon(self): | 68 def _getWeapon(self): |
79 | 82 |
80 def applyHit(self, hp): | 83 def applyHit(self, hp): |
81 self._hitpoints -= hp | 84 self._hitpoints -= hp |
82 if self._hitpoints <= 0: | 85 if self._hitpoints <= 0: |
83 self.destroy() | 86 self.destroy() |
87 else: | |
88 self._scene.soundmanager.playClip(self._hitclip) | |
84 | 89 |
85 def destroy(self): | 90 def destroy(self): |
86 if self._running: | 91 if self._running: |
87 self._instance.act('explode', self._instance.getFacingLocation()) | 92 self._instance.act('explode', self._instance.getFacingLocation()) |
93 self._scene.soundmanager.playClip(self._explodclip) | |
88 super(Ship, self).destroy() | 94 super(Ship, self).destroy() |
89 | 95 |
90 def _getHitPoints(self): | 96 def _getHitPoints(self): |
91 return self._hitpoints | 97 return self._hitpoints |
92 | 98 |