changeset 248:37f892b59c4b

Beeps on the bridge
author Neil Muller <neil@dip.sun.ac.za>
date Fri, 27 Aug 2010 13:40:10 +0200
parents 0bad554d0926
children 913257638e6f
files Resources/sounds/beep330.ogg Resources/sounds/beep440.ogg Resources/sounds/beep660.ogg Resources/sounds/beep880.ogg Resources/sounds/sources.txt gamelib/scenes/bridge.py
diffstat 6 files changed, 25 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
Binary file Resources/sounds/beep330.ogg has changed
Binary file Resources/sounds/beep440.ogg has changed
Binary file Resources/sounds/beep660.ogg has changed
Binary file Resources/sounds/beep880.ogg has changed
--- a/Resources/sounds/sources.txt	Fri Aug 27 13:32:27 2010 +0200
+++ b/Resources/sounds/sources.txt	Fri Aug 27 13:40:10 2010 +0200
@@ -65,3 +65,10 @@
 License: http://creativecommons.org/licenses/by/3.0/
 Credit: Sound samples by Matt Lange recorded for Richard Boulanger for use in the One Laptop per Child music library. See http://wiki.laptop.org/go/Sound_samples for details.
 laser.ogg wavfile: laser9.wav
+
+[beep330.ogg]
+[beep440.ogg]
+[beep660.ogg]
+[beep880.ogg]
+Created with the gen_sound.py script in trunk/tools (330, 440, 660, 880 Hz).
+Not copyrightable.
--- a/gamelib/scenes/bridge.py	Fri Aug 27 13:32:27 2010 +0200
+++ b/gamelib/scenes/bridge.py	Fri Aug 27 13:40:10 2010 +0200
@@ -1,5 +1,7 @@
 """Bridge where the final showdown with the AI occurs."""
 
+from albow.music import change_playlist, get_music, PlayList
+
 from gamelib.cursor import CursorSprite
 from gamelib.state import Scene, Item, Thing, Result, InteractText, \
                           InteractNoImage, InteractRectUnion
@@ -11,6 +13,16 @@
     FOLDER = "bridge"
     BACKGROUND = 'bridge.png'
 
+    MUSIC = [
+            'beep330.ogg',
+            'beep660.ogg',
+            'beep880.ogg',
+            'beep440.ogg',
+            'silent.ogg',
+            'creaking.ogg',
+            'silent.ogg',
+            ]
+
     INITIAL_DATA = {
         'accessible': True,
         }
@@ -25,8 +37,14 @@
         self.add_thing(BridgeComputer())
 
     def enter(self):
+        pieces = [get_music(x, prefix='sounds') for x in self.MUSIC]
+        background_playlist = PlayList(pieces, random=True, repeat=True)
+        change_playlist(background_playlist)
         return Result("The bridge is in a sorry, shabby state")
 
+    def leave(self):
+        change_playlist(None)
+
 
 class ToMap(Door):