Mercurial > touhou
comparison pytouhou/game/player.py @ 343:94fdb6c782c1
Implement sfx for player and enemies.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Wed, 04 Jul 2012 23:41:28 +0200 |
parents | 7a05edbab88a |
children | e0e284fcb288 |
comparison
equal
deleted
inserted
replaced
342:83c9354ff3ef | 343:94fdb6c782c1 |
---|---|
95 self.sprite = Sprite() | 95 self.sprite = Sprite() |
96 self.anmrunner = ANMRunner(self.anm_wrapper, index, self.sprite) | 96 self.anmrunner = ANMRunner(self.anm_wrapper, index, self.sprite) |
97 self.anmrunner.run_frame() | 97 self.anmrunner.run_frame() |
98 | 98 |
99 | 99 |
100 def play_sound(self, name): | |
101 self._game.player_sfx.play('%s.wav' % name) | |
102 | |
103 | |
100 def collide(self): | 104 def collide(self): |
101 if not self.state.invulnerable_time and not self.death_time and self.state.touchable: # Border Between Life and Death | 105 if not self.state.invulnerable_time and not self.death_time and self.state.touchable: # Border Between Life and Death |
102 self.death_time = self._game.frame | 106 self.death_time = self._game.frame |
103 self._game.new_effect((self.state.x, self.state.y), 17) | 107 self._game.new_effect((self.state.x, self.state.y), 17) |
104 self._game.modify_difficulty(-1600) | 108 self._game.modify_difficulty(-1600) |
109 self.play_sound('pldead00') | |
105 for i in range(16): | 110 for i in range(16): |
106 self._game.new_particle((self.state.x, self.state.y), 2, 4., 256) #TODO: find the real size and range. | 111 self._game.new_particle((self.state.x, self.state.y), 2, 4., 256) #TODO: find the real size and range. |
107 | 112 |
108 | 113 |
109 def start_focusing(self): | 114 def start_focusing(self): |
119 power = min(power for power in sht.shots if self.state.power < power) | 124 power = min(power for power in sht.shots if self.state.power < power) |
120 | 125 |
121 bullets = self._game.players_bullets | 126 bullets = self._game.players_bullets |
122 lasers = self._game.players_lasers | 127 lasers = self._game.players_lasers |
123 nb_bullets_max = self._game.nb_bullets_max | 128 nb_bullets_max = self._game.nb_bullets_max |
129 | |
130 if self.fire_time % 5 == 0: | |
131 self.play_sound('plst00') | |
124 | 132 |
125 for shot in sht.shots[power]: | 133 for shot in sht.shots[power]: |
126 origin = self.orbs[shot.orb - 1] if shot.orb else self.state | 134 origin = self.orbs[shot.orb - 1] if shot.orb else self.state |
127 | 135 |
128 if shot.type == 3: | 136 if shot.type == 3: |