SFML community forums
Help => General => Topic started by: nevets_19 on May 19, 2011, 10:52:13 am
-
Hello, i am new to SFML and i wanna just do a simple program where u press an arrow key and the ball moves in the direction until you press space bar, i know in visual basic you can get timers which do this very easily (shape.left = shape.left + 1) can u make a timer function in SFML and it constantly does the action like in Visual Basic
-
This shouldn't be done with timers.
In game programming you typically have a loop which drives all logic. It usually looks something like this:
while( game_is_running )
{
ProcessEvents();
UpdateWorld();
DrawWorld();
}
You would then updates all objects in your 'UpdateWorld' function. So you could call yourball.Update();
which would move it in whatever direction it's going.