Fix hitboxes for entities

This commit is contained in:
2024-01-28 14:09:27 +01:00
parent a61768e912
commit 5d96a02284
11 changed files with 67 additions and 49 deletions

View File

@@ -386,10 +386,10 @@ static void renderGame(Game *game, float dt) {
Rotation *r = ecs_field(&it, Rotation, 3);
TextureRegion *t = ecs_field(&it, TextureRegion, 4);
for (i32 i = 0; i < it.count; i++) {
f32 sclX = s[i].x / t[i].rec.width;
f32 sclY = s[i].y / t[i].rec.height;
Rectangle dst = {p[i].x, p[i].y,
t[i].rec.width * sclX, t[i].rec.height * sclY};
Rectangle dst = {p[i].x, p[i].y - s[i].y,
s[i].x, s[i].y};
DrawCircleV(p[i], 1.0f, BLUE);
Vector2 origin = {0.0f, 0.0f};
//dst.x += origin.x - dst.width * 0.5f;
//dst.y += origin.y - dst.height * 0.5f;