Skip to content

Commit

Permalink
Return the center of the screen if we get an invalid global position
Browse files Browse the repository at this point in the history
  • Loading branch information
thatguy11325 committed Jul 10, 2024
1 parent 6baae8b commit 6a65a59
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pokemonred_puffer/global_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def local_to_global(r: int, c: int, map_n: int):
if 0 <= gy < GLOBAL_MAP_SHAPE[0] and 0 <= gx < GLOBAL_MAP_SHAPE[1]:
return gy, gx
print(f"coord out of bounds! global: ({gx}, {gy}) game: ({r}, {c}, {map_n})")
return 0, 0
return GLOBAL_MAP_SHAPE[0] // 2, GLOBAL_MAP_SHAPE[1] // 2
except KeyError:
print(f"Map id {map_n} not found in map_data.json.")
return 0, 0
return GLOBAL_MAP_SHAPE[0] // 2, GLOBAL_MAP_SHAPE[1] // 2

0 comments on commit 6a65a59

Please sign in to comment.