Extend one pixel outwards for tile collision check

scene_man
En Yi 2023-06-23 21:52:06 +08:00
parent e79fb249d2
commit 7a670f85fc
1 changed files with 2 additions and 2 deletions

View File

@ -794,8 +794,8 @@ void tile_collision_system(Scene_t* scene)
// exclude self
// This has an extra pixel when gathering potential collision, just to avoid missing any
// This is only done here, collision methods do not have this
unsigned int tile_x1 = (p_ctransform->position.x) / TILE_SIZE;
unsigned int tile_y1 = (p_ctransform->position.y) / TILE_SIZE;
unsigned int tile_x1 = (p_ctransform->position.x - 1) / TILE_SIZE;
unsigned int tile_y1 = (p_ctransform->position.y - 1) / TILE_SIZE;
unsigned int tile_x2 = (p_ctransform->position.x + p_bbox->size.x) / TILE_SIZE;
unsigned int tile_y2 = (p_ctransform->position.y + p_bbox->size.y) / TILE_SIZE;