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