2
« on: May 22, 2011, 01:08:57 am »
I got my program so I can move a sprite in all eight directions, or in a circle if I want, using the arrow keys. The problem occurs whenever I press a key, either to start moving or change direction. The character moves once, waits a half second or so, then moves steadily like I wanted. Any ideas what could be causing this delay/lag between movements? My input method is pretty standard.
//Located in event loop, same program structure in every SFML tut out there.
if (App.GetInput().IsKeyDown(sf::Key::Left))
Player.SetSubRect(0, 0, 128, 128); //facing left
Player.Move(-1, 0);
if (App.GetInput().IsKeyDown(sf::Key::Right))
Player.SetSubRect( 128, 128, 256, 256); //facing right
Player.Move(1, 0);
if (App.GetInput().IsKeyDown(sf::Key::Up))
Player.Move(0, -1);
if (App.GetInput().IsKeyDown(sf::Key::Down))
Player.Move(0, 1);