Corrections dans dashtimeout pour ne pas avoir un timeout relié au nombre de frames.

This commit is contained in:
Marc-Eric Martel 2021-10-08 09:21:16 -04:00
parent 57e6c5192f
commit 5cca6469e0

View File

@ -22,19 +22,20 @@ void Player::Move(bool front, bool back, bool left, bool right, bool jump, bool
static float xrotrad = 0;
static bool jumped = true;
static int dbljump = 0; // Peut sauter ou dasher tant que la variable est en dessous de 2.
static int dashtimeout = 0;
static float dashtimeout = 0;
static float gametime = 0;
if (gametime <= 360.f) gametime += elapsedTime * m_topspeed / 2; else gametime = 0;
if (dashtimeout > 0) {
if (dashtimeout > 0.f) {
dash = false;
--dashtimeout;
dashtimeout -= elapsedTime;
}
else dashtimeout = 0;
if (jumped && !jump) jumped = false; // Anti-rebondissement du saut, pour pouvoir rebondir.
if (dash) dashtimeout = 100;
if (dash) dashtimeout = 5;
if ((jump || dash) && dbljump < 2 && !jumped ) {
accjmp += jump? m_jumpforce: 0.1f;