From: Neil Date: Sat, 17 May 2014 21:36:46 +0000 (+0200) Subject: Add some useful forcing options X-Git-Tag: 0.1~15^2~6 X-Git-Url: https://git.ctpug.org.za/?a=commitdiff_plain;h=b1e0f7f96569084f2d812184b829ca593d6e2f65;p=naja.git Add some useful forcing options --- diff --git a/naja/scenes/game.py b/naja/scenes/game.py index c0b4b27..82e08db 100644 --- a/naja/scenes/game.py +++ b/naja/scenes/game.py @@ -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 diff --git a/naja/widgets/board.py b/naja/widgets/board.py index 32fb5af..b2a93fa 100644 --- a/naja/widgets/board.py +++ b/naja/widgets/board.py @@ -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)