diff --git a/player.cpp b/player.cpp index 80d32599293c3f375f749b5f1f7b40ea32ce9988..d48df2fb3921752bc2b55e5a2528dbed31dc20a2 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; } } }