Sorry... I am a very newbie to game programming, and this website so if I say something wrong, please be forgivable. I recently try to code the game tankwar and run into one of the graphics problem. The tank that I create move very rigid, not smooth at all. And If I try to make it go smooth, the tank wont ever stop. Here is portion of my code.
The if else statement below, if I took off the else. The tank wont ever stop but it move quite smooth. If I have the else, the tank stop when I stop pressing the key but it move very rigid. I wrote my program in C using Allegro Library.
Code:
if(keypressed()){
press++;
getinput();
}else{
tank[0].speed = 0;
tank[1].speed = 0;
}
clear_keybuf(); //clear the key buffer
rest(20);
I also include my codes here. I cant upload my excute file because the website wont allow me.