comparison demos/shooter/scripts/ships/player.py @ 485:d365eb58f3d6

SoundClip can now fire a callback after a sound has completed being played (i.e. the duration of the sound has passed by). I have added an example of this with the scene music. [t:346]
author prock@33b003aa-7bff-0310-803a-e67f0ece8222
date Fri, 30 Apr 2010 15:37:33 +0000
parents ab28994820dd
children c4168eb47a44
comparison
equal deleted inserted replaced
484:e584b0b8b4a2 485:d365eb58f3d6
55 55
56 self._actionlistener = PlayerActionListener(self) 56 self._actionlistener = PlayerActionListener(self)
57 57
58 self._lives = 3 58 self._lives = 3
59 self.init() 59 self.init()
60
60 61
61 def init(self): 62 def init(self):
62 self._hitpoints = 2 63 self._hitpoints = 2
63 self._dead = False 64 self._dead = False
64 self._invulnerable = False 65 self._invulnerable = False
109 self.flash(1) 110 self.flash(1)
110 111
111 def destroy(self): 112 def destroy(self):
112 if not self._invulnerable and not self._dead: 113 if not self._invulnerable and not self._dead:
113 self._instance.act('explode', self._instance.getFacingLocation()) 114 self._instance.act('explode', self._instance.getFacingLocation())
115 self._scene.soundmanager.playClip(self._explodclip)
114 self._dead = True 116 self._dead = True
115 self._invulnerable = True 117 self._invulnerable = True
116 self._lives -= 1 118 self._lives -= 1
117 119
118 def fire(self, direction): 120 def fire(self, direction):