static int temp_lag=0;
if(GetTickCount()-temp_lag>bullet_lag) {
if(KEYDOWN(VK_UP)) {
//do stuff
}
temp_lag=GetTickCount();
}
The problem with the above code is that when i first load the game and attempt to use KEYDOWN(VK_UP) it doesn't work.. i know this is because the if statement hasn't been fulfilled. My question is if there is anyway around this?
Timer Question...
Would it be possible to assign temp_lag a negative interger so that the condition would filled? After the initial run through, the contents of temp_lag would be a valid value for your application.
Original post by ecr0nstatic int temp_lag=0;if(GetTickCount()-temp_lag>bullet_lag) { if(KEYDOWN(VK_UP)) { //do stuff } temp_lag=GetTickCount();}
isn't anything minus 0 always itself?
How about this?
static int temp_lag=0;if((GetTickCount()-temp_lag>bullet_lag) || temp_lag == 0) { if(KEYDOWN(VK_UP)) { //do stuff } temp_lag=GetTickCount();}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement