Optimize tower entity checking

This commit is contained in:
2024-02-10 16:11:03 +01:00
parent 27dcc42ce0
commit 1b28a93d91

View File

@@ -372,7 +372,11 @@ void updateTower(ecs_iter_t *it) {
}
}
if (target == 0) continue;
if (target == 0) {
const f32 CHECK_INTERVAL = 0.2f; // 5 times a second
tower[i].fireElapsed = tower[i].fireCooldown - CHECK_INTERVAL;
continue;
}
Vector2 dir = Vector2Subtract(targetPos, center);
dir = Vector2Normalize(dir);