-
Notifications
You must be signed in to change notification settings - Fork 0
/
game.py
26 lines (24 loc) · 925 Bytes
/
game.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import world
from player import Player
def play():
world.load_tiles()
player = Player()
room = world.tile_exists(player.location_x, player.location_y)
print(room.intro_text())
while player.is_alive() and not player.victory:
#loop starts here
room = world.tile_exists(player.location_x, player.location_y)
room.modify_player(player)
#check again bc room could change player state
if player.is_alive() and not player.victory:
print("Choose an action:\n")
available_actions = room.available_actions()
for action in available_actions:
print(action)
action_input = input('Action: ')
for action in available_actions:
if action_input == action.hotkey:
player.do_action(action, **action.kwargs)
break
if __name__ == "__main__":
play()