From: Neil Date: Fri, 16 May 2014 22:13:26 +0000 (+0200) Subject: Espescially if it plays X-Git-Tag: 0.1~170 X-Git-Url: https://git.ctpug.org.za/?p=naja.git;a=commitdiff_plain;h=3fee41ef2a3153579d9a9c9fe2b81dfb90e17352 Espescially if it plays --- diff --git a/naja/constants.py b/naja/constants.py index 25def14..ae812f7 100644 --- a/naja/constants.py +++ b/naja/constants.py @@ -143,3 +143,11 @@ ACTION_GLYPHS = AttrDict({ 'MSB': 'glyphs/msb.png', 'NOTHING': 'glyphs/do_nothing.png', }) + +TUNES = [ + 'ants.ogg', + 'python.ogg', + 'death_on_a_b.ogg', + 'scape.ogg', + 'another_beek.ogg', + ] diff --git a/naja/scenes/game.py b/naja/scenes/game.py index 0e76f5f..c0b4b27 100644 --- a/naja/scenes/game.py +++ b/naja/scenes/game.py @@ -3,8 +3,9 @@ Gameboard scene. """ import pygame.locals as pgl +import random -from naja.constants import KEYS +from naja.constants import KEYS, TUNES from naja.events import SceneChangeEvent, finish_event from naja.options import options from naja.scenes.scene import Scene @@ -30,11 +31,14 @@ class GameScene(Scene): self.add(info) self.add(RobotWidget(state)) 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 if ev.type == pgl.KEYDOWN: if ev.key in KEYS.QUIT: + sound.stop() SceneChangeEvent.post(MenuScene) return if options.cheat_enabled: