Mercurial > touhou
comparison pytouhou/ui/gamerunner.py @ 379:e0e284fcb288
Make a sound when an enemy is hit.
author | Emmanuel Gil Peyrot <linkmauve@linkmauve.fr> |
---|---|
date | Thu, 30 Aug 2012 11:34:56 +0200 |
parents | 11d895b6c0dc |
children | 690b5faaa0e6 |
comparison
equal
deleted
inserted
replaced
378:11d895b6c0dc | 379:e0e284fcb288 |
---|---|
27 | 27 |
28 from pytouhou.utils.helpers import get_logger | 28 from pytouhou.utils.helpers import get_logger |
29 from pytouhou.utils.matrix import Matrix | 29 from pytouhou.utils.matrix import Matrix |
30 | 30 |
31 from .gamerenderer import GameRenderer | 31 from .gamerenderer import GameRenderer |
32 from .music import MusicPlayer, SFXPlayer | 32 from .music import MusicPlayer, SFXPlayer, NullPlayer |
33 from .shaders.eosd import GameShader, BackgroundShader | 33 from .shaders.eosd import GameShader, BackgroundShader |
34 | 34 |
35 | 35 |
36 logger = get_logger(__name__) | 36 logger = get_logger(__name__) |
37 | 37 |
73 | 73 |
74 self.save_keystates = save_keystates | 74 self.save_keystates = save_keystates |
75 | 75 |
76 game.music = MusicPlayer(game.resource_loader, bgms) | 76 game.music = MusicPlayer(game.resource_loader, bgms) |
77 game.music.play(0) | 77 game.music.play(0) |
78 | 78 game.sfx_player = SFXPlayer(game.resource_loader) if not self.skip else NullPlayer() |
79 game.player_sfx = SFXPlayer(game.resource_loader) | |
80 game.enemy_sfx = SFXPlayer(game.resource_loader) | |
81 | 79 |
82 | 80 |
83 def set_input(self, replay=None): | 81 def set_input(self, replay=None): |
84 if not replay or not replay.levels[self.game.stage-1]: | 82 if not replay or not replay.levels[self.game.stage-1]: |
85 self.keys = pyglet.window.key.KeyStateHandler() | 83 self.keys = pyglet.window.key.KeyStateHandler() |
175 except StopIteration: | 173 except StopIteration: |
176 keystate = 0 | 174 keystate = 0 |
177 if self.skip: | 175 if self.skip: |
178 self.set_input() | 176 self.set_input() |
179 self.skip = False | 177 self.skip = False |
178 self.game.sfx_player = SFXPlayer(self.game.resource_loader) | |
180 | 179 |
181 if self.save_keystates is not None: | 180 if self.save_keystates is not None: |
182 self.save_keystates.append(keystate) | 181 self.save_keystates.append(keystate) |
183 | 182 |
184 self.game.run_iter(keystate) | 183 self.game.run_iter(keystate) |