From e686e9496be1433c549da1ebe0764fea74933868 Mon Sep 17 00:00:00 2001 From: Klemen Plestenjak Date: Tue, 13 Feb 2024 19:22:48 +0100 Subject: [PATCH] Add slight pushback also on non-stationary entities --- game/systems/s_entity.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/game/systems/s_entity.c b/game/systems/s_entity.c index eed67df..3020fd9 100644 --- a/game/systems/s_entity.c +++ b/game/systems/s_entity.c @@ -217,11 +217,10 @@ void entityUpdate(ecs_iter_t *it) { } - if (stationary) { - dir = Vector2Normalize(dir); - dir = Vector2Scale(dir, 4000 * dt); - velocity[i] = Vector2Subtract(velocity[i], dir); - } + const f32 force = stationary ? 4000 : 1000; + dir = Vector2Normalize(dir); + dir = Vector2Scale(dir, force * dt); + velocity[i] = Vector2Subtract(velocity[i], dir); slowDown = BZ_MIN(slowDown, 0.65f); if (!stationary && slowDown > 0.0f) {