comparison gamelib/scenes/bridge.py @ 251:602fe654bd37

Das blinken lights
author Neil Muller <neil@dip.sun.ac.za>
date Fri, 27 Aug 2010 16:20:26 +0200
parents 37f892b59c4b
children dfc89bc64fdb
comparison
equal deleted inserted replaced
250:df57386908c0 251:602fe654bd37
1 """Bridge where the final showdown with the AI occurs.""" 1 """Bridge where the final showdown with the AI occurs."""
2
3 import random
2 4
3 from albow.music import change_playlist, get_music, PlayList 5 from albow.music import change_playlist, get_music, PlayList
4 6
5 from gamelib.cursor import CursorSprite 7 from gamelib.cursor import CursorSprite
6 from gamelib.state import Scene, Item, Thing, Result, InteractText, \ 8 from gamelib.state import Scene, Item, Thing, Result, InteractText, \
7 InteractNoImage, InteractRectUnion 9 InteractNoImage, InteractRectUnion, InteractAnimated
8 from gamelib.statehelpers import GenericDescThing 10 from gamelib.statehelpers import GenericDescThing
9 from gamelib.scenes.scene_widgets import Door 11 from gamelib.scenes.scene_widgets import Door
10 12
11 class Bridge(Scene): 13 class Bridge(Scene):
12 14
33 self.add_item(Stethoscope('stethoscope')) 35 self.add_item(Stethoscope('stethoscope'))
34 self.add_thing(ToMap()) 36 self.add_thing(ToMap())
35 self.add_thing(MassageChair()) 37 self.add_thing(MassageChair())
36 self.add_thing(StethoscopeThing()) 38 self.add_thing(StethoscopeThing())
37 self.add_thing(BridgeComputer()) 39 self.add_thing(BridgeComputer())
40 self.add_thing(LeftLights())
41 self.add_thing(RightLights())
38 42
39 def enter(self): 43 def enter(self):
40 pieces = [get_music(x, prefix='sounds') for x in self.MUSIC] 44 pieces = [get_music(x, prefix='sounds') for x in self.MUSIC]
41 background_playlist = PlayList(pieces, random=True, repeat=True) 45 background_playlist = PlayList(pieces, random=True, repeat=True)
42 change_playlist(background_playlist) 46 change_playlist(background_playlist)
158 .set_data('contains_superconductor', False) 162 .set_data('contains_superconductor', False)
159 self.scene.remove_thing(self) 163 self.scene.remove_thing(self)
160 return Result("You pick up the stethoscope and verify that the doctor's " 164 return Result("You pick up the stethoscope and verify that the doctor's "
161 "heart has stoped. Probably a while ago.") 165 "heart has stoped. Probably a while ago.")
162 166
167 class BlinkingLights(Thing):
168
169 def get_description(self):
170 return random.choice([
171 "The lights flash in interesting patterns.",
172 "The flashing lights don't mean anything to you",
173 "The console lights flash and flicker",
174 ])
175
176 class LeftLights(BlinkingLights):
177
178 NAME ='bridge.lights.1'
179
180 INTERACTS = {
181 "lights": InteractAnimated(176, 337, ["bridge_lights_1_1.png", "bridge_lights_1_2.png", "bridge_lights_1_3.png", "bridge_lights_1_2.png"], 5)
182 }
183
184 INITIAL = 'lights'
185
186 class RightLights(BlinkingLights):
187
188 NAME ='bridge.lights.2'
189
190 INTERACTS = {
191 "lights": InteractAnimated(559, 332, ["bridge_lights_2_1.png", "bridge_lights_2_2.png", "bridge_lights_2_3.png", "bridge_lights_2_2.png"], 5)
192 }
193
194 INITIAL = 'lights'
195
196
197
163 class ChairDetail(Scene): 198 class ChairDetail(Scene):
164 199
165 FOLDER = 'bridge' 200 FOLDER = 'bridge'
166 BACKGROUND = 'chair_detail.png' 201 BACKGROUND = 'chair_detail.png'
167 NAME = 'chair_detail' 202 NAME = 'chair_detail'