Mercurial > pyntnclick
comparison gamelib/scenes/map.py @ 132:686bb74a52f8
Map shows accessible areas.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Tue, 24 Aug 2010 19:22:01 +0200 |
parents | 97c5ff0a05bb |
children | 0530547a131f |
comparison
equal
deleted
inserted
replaced
131:97c5ff0a05bb | 132:686bb74a52f8 |
---|---|
25 self.add_thing(ToBridge()) | 25 self.add_thing(ToBridge()) |
26 self.add_thing(ToMess()) | 26 self.add_thing(ToMess()) |
27 self.add_thing(ToEngine()) | 27 self.add_thing(ToEngine()) |
28 self.add_thing(ToMachine()) | 28 self.add_thing(ToMachine()) |
29 | 29 |
30 def enter(self): | |
31 for door_thing in self.things.values(): | |
32 door_thing.check_dest() | |
33 | |
30 | 34 |
31 class DoorThing(Thing): | 35 class DoorThing(Thing): |
32 | 36 |
33 # name of destination | 37 # name of destination |
34 DEST = None | 38 DEST = None |
35 | 39 |
36 def interact_without(self): | 40 def interact_without(self): |
37 """Go to destination.""" | 41 """Go to destination.""" |
38 if self.DEST in self.state.scenes: | 42 if self.DEST in self.state.scenes: |
39 self.state.set_current_scene('bridge') | 43 self.state.set_current_scene(self.DEST) |
40 return Result("You head for the %s." % self.DEST) | 44 return Result("You head for the %s." % self.DEST) |
45 | |
46 def check_dest(self): | |
47 if self.DEST in self.state.scenes: | |
48 if self.state.scenes[self.DEST].get_data('accessible'): | |
49 self.set_interact('accessible') | |
50 else: | |
51 self.set_interact('inaccessible') | |
41 | 52 |
42 | 53 |
43 class ToCryo(DoorThing): | 54 class ToCryo(DoorThing): |
44 "Way to cryo room." | 55 "Way to cryo room." |
45 | 56 |
46 NAME = "map.tocryo" | 57 NAME = "map.tocryo" |
47 DEST = "cryo" | 58 DEST = "cryo" |
48 | 59 |
49 INTERACTS = { | 60 INTERACTS = { |
50 "room": InteractText(100, 200, "To Cryo"), | 61 "inaccessible": InteractText(100, 200, "To Cryo"), |
62 "accessible": InteractText(100, 200, "To Cryo", (0, 127, 0)), | |
51 } | 63 } |
52 | 64 |
53 INITIAL = "room" | 65 INITIAL = "inaccessible" |
54 | 66 |
55 | 67 |
56 class ToBridge(DoorThing): | 68 class ToBridge(DoorThing): |
57 "Way to bridge room." | 69 "Way to bridge room." |
58 | 70 |
59 NAME = "map.tobridge" | 71 NAME = "map.tobridge" |
60 DEST = "bridge" | 72 DEST = "bridge" |
61 | 73 |
62 INTERACTS = { | 74 INTERACTS = { |
63 "room": InteractText(300, 200, "To Bridge"), | 75 "inaccessible": InteractText(300, 200, "To Bridge"), |
76 "accessible": InteractText(300, 200, "To Bridge", (0, 127, 0)), | |
64 } | 77 } |
65 | 78 |
66 INITIAL = "room" | 79 INITIAL = "inaccessible" |
67 | 80 |
68 | 81 |
69 class ToMess(DoorThing): | 82 class ToMess(DoorThing): |
70 "Way to cryo room." | 83 "Way to cryo room." |
71 | 84 |
72 NAME = "map.tomess" | 85 NAME = "map.tomess" |
73 DEST = "mess" | 86 DEST = "mess" |
74 | 87 |
75 INTERACTS = { | 88 INTERACTS = { |
76 "room": InteractText(100, 300, "To Mess"), | 89 "inaccessible": InteractText(100, 300, "To Mess"), |
90 "accessible": InteractText(100, 300, "To Mess", (0, 127, 0)), | |
77 } | 91 } |
78 | 92 |
79 INITIAL = "room" | 93 INITIAL = "inaccessible" |
80 | 94 |
81 | 95 |
82 class ToEngine(Thing): | 96 class ToEngine(DoorThing): |
83 "Way to engine room." | 97 "Way to engine room." |
84 | 98 |
85 NAME = "map.toengine" | 99 NAME = "map.toengine" |
86 DEST = "engine" | 100 DEST = "engine" |
87 | 101 |
88 INTERACTS = { | 102 INTERACTS = { |
89 "room": InteractText(300, 300, "To Engine"), | 103 "inaccessible": InteractText(300, 300, "To Engine"), |
104 "accessible": InteractText(300, 300, "To Engine", (0, 127, 0)), | |
90 } | 105 } |
91 | 106 |
92 INITIAL = "room" | 107 INITIAL = "inaccessible" |
93 | 108 |
94 | 109 |
95 class ToMachine(DoorThing): | 110 class ToMachine(DoorThing): |
96 "Way to machine room." | 111 "Way to machine room." |
97 | 112 |
98 NAME = "map.tomachine" | 113 NAME = "map.tomachine" |
99 DEST = "machine" | 114 DEST = "machine" |
100 | 115 |
101 INTERACTS = { | 116 INTERACTS = { |
102 "room": InteractText(100, 400, "To Machine"), | 117 "inaccessible": InteractText(100, 400, "To Machine"), |
118 "accessible": InteractText(100, 400, "To Machine", (0, 127, 0)), | |
103 } | 119 } |
104 | 120 |
105 INITIAL = "room" | 121 INITIAL = "inaccessible" |
106 | 122 |
107 | 123 |
108 SCENES = [Map] | 124 SCENES = [Map] |