Fix tunneling for wooden tile
Just make the collision bbox to be tile_size. The 'hitbox' of the tile is too thin.scene_man
parent
3f5e1648c1
commit
e1bef49d06
|
@ -759,12 +759,19 @@ void tile_collision_system(Scene_t* scene)
|
||||||
if(tilemap.tiles[tile_idx].tile_type != EMPTY_TILE)
|
if(tilemap.tiles[tile_idx].tile_type != EMPTY_TILE)
|
||||||
{
|
{
|
||||||
Vector2 other;
|
Vector2 other;
|
||||||
other.x = (tile_idx % tilemap.width) * TILE_SIZE + tilemap.tiles[tile_idx].offset.x;
|
other.x =
|
||||||
other.y = (tile_idx / tilemap.width) * TILE_SIZE + tilemap.tiles[tile_idx].offset.y; // Precision loss is intentional
|
(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(
|
check_collision_and_move(
|
||||||
&tilemap, p_ent,
|
&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
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue