Hide health bar, if it was not changed
This commit is contained in:
@@ -389,7 +389,12 @@ void renderHealthBar(ecs_iter_t *it) {
|
|||||||
HitBox *hitbox = ecs_field(it, HitBox, 2);
|
HitBox *hitbox = ecs_field(it, HitBox, 2);
|
||||||
Health *health = ecs_field(it, Health, 3);
|
Health *health = ecs_field(it, Health, 3);
|
||||||
|
|
||||||
|
f32 time = GetTime();
|
||||||
|
|
||||||
for (i32 i = 0; i < it->count; i++) {
|
for (i32 i = 0; i < it->count; i++) {
|
||||||
|
f32 lastChange = time - health[i].lastChanged;
|
||||||
|
if (lastChange > 2.0f) continue;
|
||||||
|
|
||||||
HitBox hb = entityTransformHitBox(pos[i], hitbox[i]);
|
HitBox hb = entityTransformHitBox(pos[i], hitbox[i]);
|
||||||
const f32 HP_WIDTH = 10.0f;
|
const f32 HP_WIDTH = 10.0f;
|
||||||
const f32 HP_HEIGHT = 1.8f;
|
const f32 HP_HEIGHT = 1.8f;
|
||||||
|
|||||||
Reference in New Issue
Block a user