Mercurial > boomslang
annotate gamelib/scenes/scene_widgets.py @ 252:dfc89bc64fdb
Start of walkthrough "unit test" and associated fixes and tweaks.
author | Jeremy Thurgood <firxen@gmail.com> |
---|---|
date | Fri, 27 Aug 2010 16:45:47 +0200 |
parents | 12c4f87ea424 |
children | 3b4a78422201 |
rev | line source |
---|---|
242 | 1 """Generic, game specific widgets""" |
2 | |
3 import random | |
4 | |
5 from gamelib.state import Thing, Result | |
6 | |
7 | |
8 class Door(Thing): | |
9 """A door somewhere""" | |
10 | |
11 DEST = "map" | |
252
dfc89bc64fdb
Start of walkthrough "unit test" and associated fixes and tweaks.
Jeremy Thurgood <firxen@gmail.com>
parents:
242
diff
changeset
|
12 SCENE = None |
dfc89bc64fdb
Start of walkthrough "unit test" and associated fixes and tweaks.
Jeremy Thurgood <firxen@gmail.com>
parents:
242
diff
changeset
|
13 |
dfc89bc64fdb
Start of walkthrough "unit test" and associated fixes and tweaks.
Jeremy Thurgood <firxen@gmail.com>
parents:
242
diff
changeset
|
14 def __init__(self): |
dfc89bc64fdb
Start of walkthrough "unit test" and associated fixes and tweaks.
Jeremy Thurgood <firxen@gmail.com>
parents:
242
diff
changeset
|
15 self.NAME = self.SCENE + '.door' |
dfc89bc64fdb
Start of walkthrough "unit test" and associated fixes and tweaks.
Jeremy Thurgood <firxen@gmail.com>
parents:
242
diff
changeset
|
16 Thing.__init__(self) |
242 | 17 |
18 def is_interactive(self): | |
19 return True | |
20 | |
21 def interact_without(self): | |
22 """Go to map.""" | |
23 self.state.set_current_scene("map") | |
24 | |
25 def get_description(self): | |
26 return 'An open doorway leads to the rest of the ship.' | |
27 | |
28 def interact_default(self, item): | |
29 return Result(random.choice([ | |
30 "Sadly, this isn't that sort of game.", | |
31 "Your valiant efforts are foiled by the Evil Game Designer.", | |
32 "Waving that in the doorway does nothing. Try something else, perhaps?", | |
33 ])) | |
34 |