comparison gamelib/scenes/cryo.py @ 56:75bf3d3689e9

Refactor thing interactivity and add "fake" bridge scene.
author Jeremy Thurgood <firxen@gmail.com>
date Mon, 23 Aug 2010 13:39:12 +0200
parents 2e2f6ff54780
children 3087be3463e0
comparison
equal deleted inserted replaced
55:2e2f6ff54780 56:75bf3d3689e9
46 46
47 INITIAL_DATA = { 47 INITIAL_DATA = {
48 'open': False, 48 'open': False,
49 } 49 }
50 50
51 def interact(self, item):
52 if self.get_data('open'):
53 print "Door open"
54 return
55 Thing.interact(self, item)
56
57 def interact_with_titanium_leg(self, item): 51 def interact_with_titanium_leg(self, item):
58 self.message("You wedge the titanium leg into the chain and twist. With a satisfying *snap*, the chain breaks and the door opens.") 52 self.message("You wedge the titanium leg into the chain and twist. With a satisfying *snap*, the chain breaks and the door opens.")
59 self.open_door() 53 self.open_door()
60 54
61 def interact_without(self): 55 def interact_without(self):
66 "Sadly, this isn't that sort of game.", 60 "Sadly, this isn't that sort of game.",
67 "Your valiant efforts are foiled by the Evil Game Designer.", 61 "Your valiant efforts are foiled by the Evil Game Designer.",
68 "The door resists. Try something else, perhaps?", 62 "The door resists. Try something else, perhaps?",
69 ])) 63 ]))
70 64
65 def is_interactive(self):
66 return not self.get_data('open')
67
71 def open_door(self): 68 def open_door(self):
72 self.set_data('open', True) 69 self.set_data('open', True)
73 self.state.scenes['bridge'].set_data('accessible', True) 70 self.state.scenes['bridge'].set_data('accessible', True)
74 71
75 72