From 5fb2c135c72026901ce8c1391627ce72e97818de Mon Sep 17 00:00:00 2001 From: Claudio Hoffmann <hoffmanncl72341@th-nuernberg.de> Date: Sat, 16 Jan 2021 03:47:41 +0100 Subject: [PATCH] Player: Increase movement animation speed (by a lot) --- player.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/player.cpp b/player.cpp index 80d3259..d48df2f 100644 --- a/player.cpp +++ b/player.cpp @@ -186,15 +186,10 @@ void Player::move(Platform &p, FloatSeconds const & Frametime, Level &level) if(deltaX!=0||deltaY!=0) { - if(animationtimer>speed*Frametime.count()) - { - animationstep = 1-animationstep; - animationtimer = 0; - } - else - { - animationtimer += Frametime.count(); - } + int constexpr ANIMATION_FRAMES = 2; + float constexpr ANIMATION_FRAME_TIME = 0.1f; + animationtimer += Frametime.count(); + animationstep = static_cast<int>(animationtimer / ANIMATION_FRAME_TIME) % ANIMATION_FRAMES; } } } -- GitLab