comparison gamelib/scenes/bridge.py @ 248:37f892b59c4b

Beeps on the bridge
author Neil Muller <neil@dip.sun.ac.za>
date Fri, 27 Aug 2010 13:40:10 +0200
parents 12c4f87ea424
children 602fe654bd37
comparison
equal deleted inserted replaced
247:0bad554d0926 248:37f892b59c4b
1 """Bridge where the final showdown with the AI occurs.""" 1 """Bridge where the final showdown with the AI occurs."""
2
3 from albow.music import change_playlist, get_music, PlayList
2 4
3 from gamelib.cursor import CursorSprite 5 from gamelib.cursor import CursorSprite
4 from gamelib.state import Scene, Item, Thing, Result, InteractText, \ 6 from gamelib.state import Scene, Item, Thing, Result, InteractText, \
5 InteractNoImage, InteractRectUnion 7 InteractNoImage, InteractRectUnion
6 from gamelib.statehelpers import GenericDescThing 8 from gamelib.statehelpers import GenericDescThing
8 10
9 class Bridge(Scene): 11 class Bridge(Scene):
10 12
11 FOLDER = "bridge" 13 FOLDER = "bridge"
12 BACKGROUND = 'bridge.png' 14 BACKGROUND = 'bridge.png'
15
16 MUSIC = [
17 'beep330.ogg',
18 'beep660.ogg',
19 'beep880.ogg',
20 'beep440.ogg',
21 'silent.ogg',
22 'creaking.ogg',
23 'silent.ogg',
24 ]
13 25
14 INITIAL_DATA = { 26 INITIAL_DATA = {
15 'accessible': True, 27 'accessible': True,
16 } 28 }
17 29
23 self.add_thing(MassageChair()) 35 self.add_thing(MassageChair())
24 self.add_thing(StethoscopeThing()) 36 self.add_thing(StethoscopeThing())
25 self.add_thing(BridgeComputer()) 37 self.add_thing(BridgeComputer())
26 38
27 def enter(self): 39 def enter(self):
40 pieces = [get_music(x, prefix='sounds') for x in self.MUSIC]
41 background_playlist = PlayList(pieces, random=True, repeat=True)
42 change_playlist(background_playlist)
28 return Result("The bridge is in a sorry, shabby state") 43 return Result("The bridge is in a sorry, shabby state")
44
45 def leave(self):
46 change_playlist(None)
29 47
30 48
31 class ToMap(Door): 49 class ToMap(Door):
32 50
33 NAME = "bridge.tomap" 51 NAME = "bridge.tomap"