From 57bc76e57757fbf1c26e1fcf63d20a102df4d98b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miloslav=20=C4=8C=C3=AD=C5=BE?= Date: Sun, 13 Sep 2020 19:53:04 +0200 Subject: [PATCH] Fix jump bug --- constants.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/constants.h b/constants.h index 77828c7..a3af8c1 100644 --- a/constants.h +++ b/constants.h @@ -267,7 +267,12 @@ #endif #define SFG_PLAYER_JUMP_OFFSET_PER_FRAME \ - ((SFG_PLAYER_JUMP_SPEED * RCL_UNITS_PER_SQUARE) / SFG_FPS) + (((SFG_PLAYER_JUMP_SPEED * RCL_UNITS_PER_SQUARE) / SFG_FPS) \ + - SFG_GRAVITY_SPEED_INCREASE_PER_FRAME / 2) + /* ^ This substraction corrects the initial veloc. so that the numeric curve + copies the analytical (smooth) curve. Without it the numeric curve goes + ABOVE and makes player jump higher with lower FPS. To make sense of this + try to solve the differential equation and plot it. */ #if SFG_PLAYER_JUMP_OFFSET_PER_FRAME == 0 #define SFG_PLAYER_JUMP_OFFSET_PER_FRAME 1