From 5cca6469e0caf3632f654c4e2f41ba7af03587dc Mon Sep 17 00:00:00 2001 From: Marc-Eric Martel <1205697@etu.cegepsth.qc.ca> Date: Fri, 8 Oct 2021 09:21:16 -0400 Subject: [PATCH] =?UTF-8?q?Corrections=20dans=20dashtimeout=20pour=20ne=20?= =?UTF-8?q?pas=20avoir=20un=20timeout=20reli=C3=A9=20au=20nombre=20de=20fr?= =?UTF-8?q?ames.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- SQCSim2021/player.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/SQCSim2021/player.cpp b/SQCSim2021/player.cpp index e7e3152..57a2e71 100644 --- a/SQCSim2021/player.cpp +++ b/SQCSim2021/player.cpp @@ -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;