Quote:
Originally posted by Gorbash9k
Hey this is my first post here, so i dont know if you guys have the haze the newbie policy or anything like that, but i need some quick help.
I'm in my second year of Computer Science (C++) and we have to do a dossier, where basically its a decent size program that follow several requirements. My is a basic game, divider down the middle, one person on each side. Object is to avoid the shot from the oppent but to shoot them. Simple.
The only problem i have is im trying to make it in a real time format, an accquintence kept on yelling about key buffering and sent me an example that made no sense, so i was wondering if one of you guys could help me with this. I can send you my program in the works if you want to see what im talking about.
|
firstly, welcome to the forums. I'm new myself and I would say I am fairly certain a website called "codenewbies" would not be about hazing newbies :-)
On to your dilema. Bascially what you want is to setup an infinite loop. You will process very tiny descrete units of time in each loop. For a general algorithm:
Start game;
while(Game!=done){
get keyboard input
update game to next 'cycle'
if (winner) Game = done;
}
You are concerned with the keyboard input. I believe there is an easy way to do this in C but can't think of it right now. Your friends example of keyboard buffering sounds like it might do the trick. If you can, post the example on the forums or a webpage. I will try to explain it the best I can.