Play sounds when moving around the board
authorStefano Rivera <stefano@rivera.za.net>
Fri, 16 May 2014 18:12:30 +0000 (20:12 +0200)
committerStefano Rivera <stefano@rivera.za.net>
Fri, 16 May 2014 18:12:30 +0000 (20:12 +0200)
naja/widgets/board.py

index f9bb80c189cb32baa1bf4f8296707db38c871909..b168c6b35ec3a706ad279285a9a99bf6daa65eea 100644 (file)
@@ -5,6 +5,7 @@ import pygame.locals as pgl
 
 from naja.constants import BOARD_SIZE, TILE_SIZE, KEYS, ACT
 from naja.events import finish_event
+from naja.sound import sound
 
 from naja.widgets.base import Widget
 from naja.widgets.tile import TileWidget
@@ -43,6 +44,7 @@ class BoardWidget(Widget):
         self.card_pos = card_pos
         self.info.set_position(self.card_pos)
         self.legal = self.card_pos in self.state.player.legal_moves()
+        sound.play_sound('zoop.ogg', volume=0.05)
 
     def change_pos(self, offset):
         tpos = (offset[0] + self.card_pos[0], offset[1] + self.card_pos[1])
@@ -83,5 +85,6 @@ class BoardWidget(Widget):
                 if self.state.player.set_position(self.card_pos):
                     self.state.gameboard.change_mode(ACT)
                     self.info.set_position(self.card_pos)
+                    sound.play_sound('chirp.ogg', volume=0.5)
                     return finish_event()
         return super(BoardWidget, self).handle_event(ev)