Fix collision checking when building

This commit is contained in:
2023-11-09 10:48:33 +01:00
parent 1ba6cd424c
commit 185c9ded6e
3 changed files with 39 additions and 6 deletions

View File

@@ -264,9 +264,7 @@ void bzTileMapDrawColliders(BzTileMap *map) {
DrawRectangleLines(posX, posY, sizeX, sizeY, color);
break;
case BZ_TILE_SHAPE_ELLIPSE:
sizeX *= 0.5f;
sizeY *= 0.5f;
DrawEllipseLines(posX + sizeX, posY + sizeY, sizeX, sizeY, color);
DrawEllipseLines(posX, posY, sizeX, sizeY, color);
break;
}
}

View File

@@ -22,6 +22,14 @@ BzTileShape bzCuteObjectToTileShape(cute_tiled_object_t *object) {
shape.sizeX = object->width;
shape.sizeY = object->height;
if (shape.type == BZ_TILE_SHAPE_ELLIPSE) {
// Adjust to use radius and position to be center
shape.sizeX *= 0.5f;
shape.sizeY *= 0.5f;
shape.x += shape.sizeX;
shape.y += shape.sizeY;
}
return shape;
}