From 67254ed31df689899f0ff23a47ae2307b7286a61 Mon Sep 17 00:00:00 2001 From: parking_turkeys Date: Thu, 16 Jul 2026 12:57:20 -0400 Subject: [PATCH] fix bug with going into walls --- level.c | 6 +++++- physics.c | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/level.c b/level.c index fddd191..61401bf 100644 --- a/level.c +++ b/level.c @@ -45,7 +45,11 @@ int bühnezeichnen(void) int in_floor(struct Rectangle *rect) { for (int i = 0; i < stages[level].platform_count; i++) { - if (CheckCollisionRecs(*rect, stages[level].platforms[i].rect)) { return 1; }; + if (CheckCollisionRecs(*rect, stages[level].platforms[i].rect)) { + if (!(stages[level].platforms[i].rect.y == rect->y + rect->height)) {// this would mean rect is just sitting on top of it + return 1; //we dont want it to return 1 if they're just on the floor + }; + }; }; return 0; } diff --git a/physics.c b/physics.c index 4b61882..a2e010e 100644 --- a/physics.c +++ b/physics.c @@ -48,7 +48,7 @@ int move_player(float d, struct character *p) { p->rect.x += stepx; p->rect.y += stepy; - if (!on_floor(&p->rect) && in_floor(&p->rect)) { + if (in_floor(&p->rect)) { p->rect.x -= stepx; p->rect.y -= stepy; for (;i < steps_phys; i++) { if (stepx > 0) {p->rect.x += 1; if (in_floor(&p->rect)) { p->rect.x-=1; };} else if (stepx < 0) {p->rect.x -= 1; if (in_floor(&p->rect)) { p->rect.x+=1; };}; -- 2.47.3