I am trying to move a ball using time. What do I need to know to move the ball?
How can I move the ball 20 pixel per second?
#include <allegro.h>
int ballx = 320;
int bally = 240;
void ball(){
if(key[KEY_RIGHT]){
}
else if(key[KEY_LEFT])
{
}
acquire_screen();
circlefill(screen,ballx,bally,5,makecol(255,255,255));
release_screen();
}
int main(){
allegro_init();
install_keyboard();
set_gfx_mode( GFX_AUTODETECT, 480, 480, 0, 0);
while(!key[KEY_ESC]){
ball();
}
return 1;
}
END_OF_MAIN();