Here is my delimma I have a player object that animates fine when only one the movement keys is pressed (I use Left, Up, Right, Down) but when 2 of them are pressed together the player moves but stops animating
this is the code
#define keyLeft sf::Key::Left
#define keyRight sf::Key::Right
#define keyUp sf::Key::Up
#define keyDown sf::Key::Down
enum direction {Left, Up, Right, Down};
noMovement = true; //bool
float ElapsedTime = App.GetFrameTime();
if (App.GetInput().IsKeyDown(keyLeft))
{
if (Player.getDirection() != Left)
{
Player.getSprite().Play(6,9);
Player.setDirection(Left);
}
Player.Move(-100*ElapsedTime,0);
noMovement = false;
}
if (App.GetInput().IsKeyDown(keyUp))
{
if (Player.getDirection() != Up)
{
Player.getSprite().Play(3,6);
Player.setDirection(Up);
}
Player.Move(0,-100*ElapsedTime);
noMovement = false;
}
if (App.GetInput().IsKeyDown(keyRight))
{
if (Player.getDirection() != Right)
{
Player.getSprite().Play(9,12);
Player.setDirection(Right);
}
Player.Move(100*ElapsedTime,0);
noMovement = false;
}
if (App.GetInput().IsKeyDown(keyDown))
{
if (Player.getDirection() != Down)
{
Player.getSprite().Play(0,3);
Player.setDirection(Down);
}
Player.Move(0,100*ElapsedTime);
noMovement = false;
}
if(noMovement)
{
Player.getSprite().Stop();
}
So hopefully someone can help me
If more code is needed ill post it all