This is the code I used
//Convert angle to radians
angleRADS = (3.1415926536/180)*(sprPlayer.GetRotation());
//Set x and y
forx = 0.01f*cos(angleRADS);
fory = 0.01f*sin(angleRADS);
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Right))
{
sprPlayer.Rotate(-0.03f);
}
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Left))
{
sprPlayer.Rotate(0.03f);
}
if ((Event.Type == sf::Event::KeyPressed) && (Event.Key.Code == sf::Key::Up))
{
sprPlayer.Move(forx, fory);
}
The problem is the code above doesn't work, when i rotate the sprite, it doesn't in the direction its meant to.
I'm new to this so any guidance, on what is wrong with the above code will be helpful.