From 6595a27503a188edcca844f2735ddc7010126ff8 Mon Sep 17 00:00:00 2001 From: KikooDX Date: Wed, 13 Jan 2021 14:23:34 +0100 Subject: [PATCH] Clipping improvement --- src/player.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/player.c b/src/player.c index 0c09e6a..643d25a 100644 --- a/src/player.c +++ b/src/player.c @@ -84,7 +84,8 @@ void player_move(Player *player, const Level *level) { if (PLAYER_COLLIDE_SOLID(destination)) { /* Used for clipping and positionning. */ int offset = destination.y % TILE_SIZE; - if (offset > H_CLIP_MARGIN) { + /* If player is rising or offset is too high then don't clip. */ + if (player->spd.y < 0 || offset > H_CLIP_MARGIN) { offset = 0; } destination.y -= offset;