I have just finished the moving animation for my 2D game (viewed from above). It works perfectly apart from one small issue.
The code is written in a way that whenever a key is pressed ( sf::Event::keyIsPressed ) a bool variable is set to true and the animation gets going.
but whenever a key is released ( sf::Event::keyIsReleased ) it stops.
Now the problem isn't a bug or a coding mistake. Its just about the concept. Say I'm going forward and I want to turn left. What I do is that whilst I'm still holding the UP key I start pressing LEFT (nearly at the same time. I have tried it with friends and they do the same). The animation and movement then work fine for left. The problem is that when it's already moving I let the UP key go and the sf::event::keyisreleased is triggered and the animation stops.
How can I make the animation stop when no keys are being pressed, without coming across this issue?







