From ff7d60ad044e98e1e2e14170b5804d141856a949 Mon Sep 17 00:00:00 2001 From: Dominik Kaiser Date: Mon, 10 Jun 2024 16:39:55 +0200 Subject: Cleanup --- src/collision.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/collision.c') diff --git a/src/collision.c b/src/collision.c index 115b70a..c416184 100644 --- a/src/collision.c +++ b/src/collision.c @@ -6,7 +6,7 @@ /* By: dkaiser size; c.position.x = actor->position.x + (actor->velocity.x * delta_time); c.position.y = actor->position.y; if ((check_map_collision(c, map, WALL) & (RIGHT | LEFT)) == 0) + { actor->position.x = c.position.x; + is_moving += (actor->direction.x != 0); + } else actor->velocity.x = 0; c.position.x = actor->position.x; c.position.y = actor->position.y + (actor->velocity.y * delta_time); if ((check_map_collision(c, map, WALL) & (UP | DOWN)) == 0) + { actor->position.y = c.position.y; + is_moving += (actor->direction.y != 0); + } else actor->velocity.y = 0; + return (is_moving != 0); } int is_on_floor(t_collider collider, t_tilemap *map) -- cgit v1.2.3