Bladesodoom1895 / textrpg

My attempt at a text rpg game.
MIT License
2 stars 1 forks source link

If a user tries to move out of bounds of the map, game crashes #17

Closed Midnex closed 1 year ago

Midnex commented 1 year ago

from b2 move to a2, move north again and the game crashes.

###################

Let's Start Now

###################

Current Zone: b2

zone b2's description

========================= What would you like to do? {'look', 'quit', 'move'}

n Unknown action, try again.

========================= What would you like to do? {'look', 'quit', 'move'}

move Where would you like to move to? n

You have moved to a2.

Current Zone: a2

zone a2's description

========================= What would you like to do? {'look', 'quit', 'move'}

move Where would you like to move to? n Traceback (most recent call last): File "/home/duckabush/Documents/GitHub/textrpg/gameinteraction.py", line 240, in title_screen() File "/home/duckabush/Documents/GitHub/textrpg/gameinteraction.py", line 31, in title_screen title_screen_selections() File "/home/duckabush/Documents/GitHub/textrpg/gameinteraction.py", line 52, in title_screen_selections setup_game(zonemap) File "/home/duckabush/Documents/GitHub/textrpg/gameinteraction.py", line 121, in setup_game main_game_loop() File "/home/duckabush/Documents/GitHub/textrpg/gameinteraction.py", line 127, in main_game_loop print_location() File "/home/duckabush/Documents/GitHub/textrpg/gameinteraction.py", line 141, in print_location prompt() File "/home/duckabush/Documents/GitHub/textrpg/gameinteraction.py", line 152, in prompt prompt() File "/home/duckabush/Documents/GitHub/textrpg/gameinteraction.py", line 158, in prompt player_move() File "/home/duckabush/Documents/GitHub/textrpg/gameinteraction.py", line 175, in player_move movement_handler(new_location) File "/home/duckabush/Documents/GitHub/textrpg/gameinteraction.py", line 183, in movement_handler main_game_loop() File "/home/duckabush/Documents/GitHub/textrpg/gameinteraction.py", line 127, in main_game_loop print_location() File "/home/duckabush/Documents/GitHub/textrpg/gameinteraction.py", line 141, in print_location prompt() File "/home/duckabush/Documents/GitHub/textrpg/gameinteraction.py", line 158, in prompt player_move() File "/home/duckabush/Documents/GitHub/textrpg/gameinteraction.py", line 175, in player_move movement_handler(new_location) File "/home/duckabush/Documents/GitHub/textrpg/gameinteraction.py", line 181, in movement_handler print("\n" + "You have moved to " + dest + ".")


TypeError: can only concatenate str (not "tuple") to str

the player_move function should check to see if the user can move out of bounds, and if so, deny's the move. Currently it crashes report `("",) is the location moved to.

Bladesodoom1895 commented 1 year ago

This bug has been fixed.