From e1bef49d06d255adcd2e24582a644e0267f508e9 Mon Sep 17 00:00:00 2001 From: En Yi Date: Thu, 16 Nov 2023 20:23:06 +0800 Subject: [PATCH] Fix tunneling for wooden tile Just make the collision bbox to be tile_size. The 'hitbox' of the tile is too thin. --- scenes/game_systems.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/scenes/game_systems.c b/scenes/game_systems.c index 0530db7..86058fc 100644 --- a/scenes/game_systems.c +++ b/scenes/game_systems.c @@ -759,12 +759,19 @@ void tile_collision_system(Scene_t* scene) if(tilemap.tiles[tile_idx].tile_type != EMPTY_TILE) { Vector2 other; - other.x = (tile_idx % tilemap.width) * TILE_SIZE + tilemap.tiles[tile_idx].offset.x; - other.y = (tile_idx / tilemap.width) * TILE_SIZE + tilemap.tiles[tile_idx].offset.y; // Precision loss is intentional + other.x = + (tile_idx % tilemap.width) * tilemap.tile_size + + tilemap.tiles[tile_idx].offset.x; + other.y = + (tile_idx / tilemap.width) * tilemap.tile_size + + tilemap.tiles[tile_idx].offset.y; // Precision loss is intentional check_collision_and_move( &tilemap, p_ent, - &other, tilemap.tiles[tile_idx].size, tilemap.tiles[tile_idx].solid + &other, + //tilemap.tiles[tile_idx].size, + (Vector2){tilemap.tile_size, tilemap.tile_size}, + tilemap.tiles[tile_idx].solid ); }