From 55f0a2210774aaea9bbf96ee8b3bd99df8f45424 Mon Sep 17 00:00:00 2001 From: Forest Belton Date: Thu, 30 Sep 2021 17:56:27 -0400 Subject: [PATCH] Fix tile coordinate when checking collision --- src/collision.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/collision.c b/src/collision.c index 6b33d3e..e2edbe1 100644 --- a/src/collision.c +++ b/src/collision.c @@ -23,12 +23,12 @@ uint8_t get_tile_coord(uint8_t pixel_coord) { } uint8_t player_bg_collides(void) { - const int8_t map_x = PLAYER.x / 8 + MAP.camera_x; + const int8_t map_x = get_tile_coord(PLAYER.x) + MAP.camera_x; if (map_x < 0 || map_x + 1 >= MAP.map_width) { return 1; } - const int8_t map_y = PLAYER.y_hi / 8 + MAP.camera_y; + const int8_t map_y = get_tile_coord(PLAYER.y_hi) + MAP.camera_y; if (map_y < 0 || map_y + 1 >= MAP.map_height) { return 1; }