diff options
| author | Thomas Kluyver <takowl@gmail.com> | 2013-01-10 16:45:18 +0000 |
|---|---|---|
| committer | Thomas Kluyver <takowl@gmail.com> | 2013-01-10 16:45:18 +0000 |
| commit | ead0301daaa6f07d9fc740050019bf204543f0ea (patch) | |
| tree | 0206475cd0c8fa0ce88572d82e776db21630be57 /weatbag/__init__.py | |
| parent | 1da208f02a091c1dc9a9912d7066805a445d09bd (diff) | |
Allow custom message when player attempts to move to nonexistent tile.
Closes gh-7
Diffstat (limited to 'weatbag/__init__.py')
| -rw-r--r-- | weatbag/__init__.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/weatbag/__init__.py b/weatbag/__init__.py index 9a743e0..511e8bc 100644 --- a/weatbag/__init__.py +++ b/weatbag/__init__.py @@ -101,7 +101,9 @@ def main(): name = input("What is your name? ") player = Player(name) interact(player) - + +no_path_msg = "The undergrowth in that direction is impassable. You turn back." + def interact(player): world = World() tile = world[player.position] @@ -120,8 +122,7 @@ def interact(player): try: tile = world[new_posn] except KeyError: - print("The undergrowth in that direction is impassable. " - "You turn back.") + print(getattr(tile, 'no_path_msg', no_path_msg)) else: player.position = new_posn tile.describe() |
