diff --git a/src/map.odin b/src/map.odin index c9964b6..a1911c0 100644 --- a/src/map.odin +++ b/src/map.odin @@ -149,6 +149,10 @@ check_map_collision :: proc(rect: rl.Rectangle, game_map: Game_Map) -> bool { // check all points along the x axis per y axis 'row' for gy := min_grid[1]; gy <= max_grid[1]; gy += 1 { for gx := min_grid[0]; gx <= max_grid[0]; gx += 1 { + + // bounds check + if gx < 0 || gx >= game_map.width || gy < 0 || gy >= game_map.height do continue + idx := (gy * game_map.width) + gx tile := Tile_Type(game_map.data[idx]) def := tile_defs[tile]