Mercurial > zrpn
changeset 88:d142c245fd31
fixed the sounds
| author | Rene Dudfield <renesd@gmail.com> |
|---|---|
| date | Sun, 08 Jul 2012 14:46:29 +0200 |
| parents | d0b93b886f40 |
| children | 97996cdd1a53 |
| files | zrpn/client.py zrpn/display.py zrpn/main.py zrpn/sprites.py |
| diffstat | 4 files changed, 19 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/zrpn/client.py Sun Jul 08 14:29:50 2012 +0200 +++ b/zrpn/client.py Sun Jul 08 14:46:29 2012 +0200 @@ -20,8 +20,6 @@ - self.shotgun = pygame.mixer.Sound(data_dir("shotgun.wav")) - self.shotgun_reload = pygame.mixer.Sound(data_dir("shotgun-reload.wav")) self.connected = False self.client = net.Client()
--- a/zrpn/display.py Sun Jul 08 14:29:50 2012 +0200 +++ b/zrpn/display.py Sun Jul 08 14:46:29 2012 +0200 @@ -16,9 +16,17 @@ pygame.init() pygame.font.init() - self.shotgun = pygame.mixer.Sound(data_dir("shotgun.wav")) - self.shotgun_reload = pygame.mixer.Sound(data_dir("shotgun-reload.wav")) + self.zombie = pygame.mixer.Sound(data_dir("zombie.ogg")) + self.robot = pygame.mixer.Sound(data_dir("robot.ogg")) + self.pirate = pygame.mixer.Sound(data_dir("pirate.ogg")) + self.ninja = pygame.mixer.Sound(data_dir("ninja.ogg")) + self.skeleton = pygame.mixer.Sound(data_dir("ninja.ogg")) + + + self.sound_types = dict(enumerate([None, self.ninja, self.pirate, self.robot, self.skeleton, self.zombie])) + + self.screen = sgc.surface.Screen((800, 600)) self.screen.fill((0x33, 0x33, 0x33)) @@ -31,6 +39,7 @@ def load_board(self, board, board_ids): for y, line in enumerate(board): for x, cell in enumerate(line): + print cell sprite = sprites.Cell((x, y), cell) self.sprites.add(sprite) cid = board_ids[y][x] @@ -46,9 +55,10 @@ else: if kind == 'die': sprite.die(turn) - - #self.shotgun.play() - self.shotgun_reload.play() + #print + print sprite.kind, kind, cid, turn, sprite + if sprite.kind in self.sound_types: + self.sound_types[sprite.kind].play() elif kind == 'fall': sprite.fall(turn)
--- a/zrpn/main.py Sun Jul 08 14:29:50 2012 +0200 +++ b/zrpn/main.py Sun Jul 08 14:46:29 2012 +0200 @@ -62,17 +62,18 @@ screen = display.Display() + pygame.display.set_caption("Zombies Robots Pirates Ninjas") + sgc.Font.set_fonts({"title": data_dir("pincoyablack.otf")}, size=60) + default_host = "localhost" default_host = "zrpn.pygame.org" - default_host = "localhost" menu = MainMenu(menu=("m:Zombies Robots Pirates Ninjas", ("f:single", "Single Player"), ("w:input_box", "name=ip", "text={}".format(default_host), "label=Enter IP for multiplayer server(eg. localhost)"), ("f:multi", "Multiplayer"), ("f:exit", "Quit"))) menu.screen = screen - pygame.display.set_caption("Zombies Robots Pirates Ninjas") clock = pygame.time.Clock() menu.add(0)
