Add some useful forcing options
authorNeil <neil@dip.sun.ac.za>
Sat, 17 May 2014 21:36:46 +0000 (23:36 +0200)
committerNeil <neil@dip.sun.ac.za>
Sat, 17 May 2014 21:37:20 +0000 (23:37 +0200)
naja/scenes/game.py
naja/widgets/board.py

index c0b4b270ffd5cca556309d28406854e4508e11e4..82e08dbe3a7c6cabd332316a8c7fe0c689fbbdb6 100644 (file)
@@ -22,17 +22,19 @@ class GameScene(Scene):
     Gameboard scene.
     """
 
-    def __init__(self, state):
+    def __init__(self, state, play_sound=True):
         super(GameScene, self).__init__(state)
         self.add(PlayerBitsWidget((0, 0), state))
         info = InfoAreaWidget((480, 0), state)
-        self.add(BoardWidget((0, 60), state, info))
+        self.board_widget = BoardWidget((0, 60), state, info)
+        self.add(self.board_widget)
         self.add(GameBitsWidget((0, 540), state))
         self.add(info)
         self.add(RobotWidget(state))
-        sound.play_sound('startup.ogg')
-        background_track = random.choice(TUNES)
-        sound.play_music(background_track, 0.25)
+        if play_sound:
+            sound.play_sound('startup.ogg')
+            background_track = random.choice(TUNES)
+            sound.play_music(background_track, 0.25)
 
     def handle_scene_event(self, ev):
         from naja.scenes.menu import MenuScene
index 32fb5af8c52a3849e110c55a9eb90a5ee9caa24c..b2a93fa8e0baa6a5fffa5cc3ba9b1b62e9ccac7e 100644 (file)
@@ -62,6 +62,10 @@ class BoardWidget(Widget):
             idx = 0
         self.update_card_pos(moves[idx])
 
+    def force_skip_animation(self):
+        for tile in self._tiles:
+            tile.animation = 0
+
     def handle_event(self, ev):
         if self.state.gameboard.player_mode == ACT:
             return super(BoardWidget, self).handle_event(ev)