comparison gamelib/scenes/cryo.py @ 109:66898d810247

Add hackish speech support (run regen-speech.py to generate files -- needs espeak and oggenc).
author Simon Cross <simon@simonx>
date Tue, 24 Aug 2010 14:32:52 +0200
parents 65976205fc2d
children e548f4a13741
comparison
equal deleted inserted replaced
108:ab11689aec36 109:66898d810247
3 import random 3 import random
4 4
5 from gamelib.state import Scene, Item, Thing, Result, \ 5 from gamelib.state import Scene, Item, Thing, Result, \
6 InteractImage, InteractNoImage, InteractRectUnion, \ 6 InteractImage, InteractNoImage, InteractRectUnion, \
7 InteractAnimated 7 InteractAnimated
8 from gamelib import speech
8 9
9 10
10 class Cryo(Scene): 11 class Cryo(Scene):
11 12
12 FOLDER = "cryo" 13 FOLDER = "cryo"
82 83
83 INITIAL_DATA = { 84 INITIAL_DATA = {
84 'door': "shut", 85 'door': "shut",
85 } 86 }
86 87
88 SPEECH = [
89 "Sadly, this isn't that sort of game.",
90 "Your valiant efforts are foiled by the Evil Game Designer.",
91 "The door resists. Try something else, perhaps?",
92 "You bang on the door with the titanium femur. It makes a clanging sound.",
93 ]
94
87 def interact_with_titanium_leg(self, item): 95 def interact_with_titanium_leg(self, item):
88 if self.get_data('door') == "ajar": 96 if self.get_data('door') == "ajar":
89 self.open_door() 97 self.open_door()
90 return Result("You wedge the titanium femur into the chain and twist. With a satisfying *snap*, the chain breaks and the door opens.") 98 return Result("You wedge the titanium femur into the chain and twist. With a satisfying *snap*, the chain breaks and the door opens.")
91 else: 99 else:
92 return Result("You bang on the door with the titanium femur. It makes a clanging sound.") 100 text = "You bang on the door with the titanium femur. It makes a clanging sound."
101 speech.say(self.name, text)
102 return Result(text)
93 103
94 def interact_without(self): 104 def interact_without(self):
95 if self.get_data('door') == "shut": 105 if self.get_data('door') == "shut":
96 self.half_open_door() 106 self.half_open_door()
97 return Result("It moves slightly and then stops. A chain on the other side is preventing it from opening completely.") 107 return Result("It moves slightly and then stops. A chain on the other side is preventing it from opening completely.")