comparison gamelib/scenes/cryo.py @ 41:ad6f56bfa8b7

Cryo door, titanium leg and some interaction prototypes.
author Jeremy Thurgood <firxen@gmail.com>
date Mon, 23 Aug 2010 00:49:22 +0200
parents 088a101f5b94
children 2e2f6ff54780
comparison
equal deleted inserted replaced
40:9fdbfbc02a60 41:ad6f56bfa8b7
1 """Cryo room where the prisoner starts out.""" 1 """Cryo room where the prisoner starts out."""
2
3 import random
2 4
3 from gamelib.state import Scene, Item, Thing 5 from gamelib.state import Scene, Item, Thing
4 6
5 7
6 class Cryo(Scene): 8 class Cryo(Scene):
7 9
8 FOLDER = "cryo" 10 FOLDER = "cryo"
9 BACKGROUND = "cryo_room.png" 11 BACKGROUND = "cryo_room.png"
10 12
13 INITIAL_DATA = {
14 'accessible': True,
15 }
16
11 def __init__(self, state): 17 def __init__(self, state):
12 super(Cryo, self).__init__(state) 18 super(Cryo, self).__init__(state)
13 self.add_item(Triangle("triangle")) 19 self.add_item(Triangle("triangle"))
14 self.add_item(Square("square")) 20 self.add_item(TitaniumLeg("titanium_leg"))
15 self.add_thing(CryoUnitAlpha("cryo.unit.1", (20, 20, 400, 500))) 21 self.add_thing(CryoUnitAlpha("cryo.unit.1", (20, 20, 400, 500)))
22 self.add_thing(CryoRoomDoor("cryo.door", (30, 30, 400, 300)))
16 23
17 24
18 class Triangle(Item): 25 class Triangle(Item):
26 "Test item. Needs to go away at some point."
27
19 INVENTORY_IMAGE = "triangle.png" 28 INVENTORY_IMAGE = "triangle.png"
20 29
21 30
22 class Square(Item): 31 class TitaniumLeg(Item):
23 INVENTORY_IMAGE = "square.png" 32 "Titanium leg, found on a piratical corpse."
33
34 INVENTORY_IMAGE = "titanium_leg.png"
24 35
25 36
26 class CryoUnitAlpha(Thing): 37 class CryoUnitAlpha(Thing):
27 pass 38 pass
28 39
29 40
41 class CryoRoomDoor(Thing):
42 "Door to the cryo room."
43
44 FOLDER = "cryo"
45 IMAGE = "cryo_door_closed"
46
47 def interact_with_titanium_leg(self, item):
48 self.message("You wedge the titanium leg into the chain and twist. With a satisfying *snap*, the chain breaks and the door opens.")
49 self.scene.remove_thing(self)
50
51 def interact_without(self):
52 self.message("It moves slightly and then stops. A chain on the other side is preventing it from opening completely.")
53
54 def interact_default(self, item):
55 self.message(random.choice([
56 "Sadly, this isn't that sort of game.",
57 "Your valiant efforts are foiled by the Evil Game Designer.",
58 "The door resists. Try something else, perhaps?",
59 ]))
60
61
30 SCENES = [Cryo] 62 SCENES = [Cryo]