comparison gamelib/scenes/cryo.py @ 566:ea9dd2b9186a pyntnclick

Hook up sound in gamelib/scenes.
author Simon Cross <hodgestar+bzr@gmail.com>
date Sat, 11 Feb 2012 15:05:18 +0200
parents 098ea4ea0d0d
children 4e9178215e75
comparison
equal deleted inserted replaced
565:88cffe418201 566:ea9dd2b9186a
1 """Cryo room where the prisoner starts out.""" 1 """Cryo room where the prisoner starts out."""
2 2
3 import random 3 import random
4 4
5 from albow.music import change_playlist, get_music, PlayList
6 from albow.resource import get_image 5 from albow.resource import get_image
7 6
8 from pyntnclick.cursor import CursorSprite 7 from pyntnclick.cursor import CursorSprite
9 from pyntnclick.state import Scene, Item, CloneableItem, Thing, Result 8 from pyntnclick.state import Scene, Item, CloneableItem, Thing, Result
10 from pyntnclick.scenewidgets import (InteractNoImage, InteractRectUnion, 9 from pyntnclick.scenewidgets import (InteractNoImage, InteractRectUnion,
127 (681, 491, 97, 60), 126 (681, 491, 97, 60),
128 ))) 127 )))
129 128
130 def enter(self): 129 def enter(self):
131 # Setup music 130 # Setup music
132 pieces = [get_music(x, prefix='sounds') for x in self.MUSIC] 131 pieces = [self.sound.get_music(x, prefix='sounds') for x in self.MUSIC]
133 background_playlist = PlayList(pieces, random=True, repeat=True) 132 background_playlist = self.sound.get_playlist(pieces, random=True,
134 change_playlist(background_playlist) 133 repeat=True)
134 self.sound.change_playlist(background_playlist)
135 if self.get_data('greet'): 135 if self.get_data('greet'):
136 self.set_data('greet', False) 136 self.set_data('greet', False)
137 return make_jim_dialog( 137 return make_jim_dialog(
138 "Greetings, Prisoner %s. I am the Judicial " 138 "Greetings, Prisoner %s. I am the Judicial "
139 "Incarceration Monitor. " 139 "Incarceration Monitor. "
144 "prison officials when we reach the destination. " 144 "prison officials when we reach the destination. "
145 "Please report to the bridge." % PLAYER_ID, self.state) 145 "Please report to the bridge." % PLAYER_ID, self.state)
146 146
147 def leave(self): 147 def leave(self):
148 # Stop music 148 # Stop music
149 change_playlist(None) 149 self.sound.change_playlist(None)
150 150
151 151
152 class CryoPipeBase(Thing): 152 class CryoPipeBase(Thing):
153 "Base class for cryo pipes that need to be stolen." 153 "Base class for cryo pipes that need to be stolen."
154 154