Hey all! I've been working on a little project over the past few days to make a game similar to the Simon Classic game where a sequence of lights flash and then you have to re-create the sequence. Anyway, I was working on the player input function but I have never worked with countdown timers. My plan was to give the player a certain amount of time to respond before losing. Currently, I am using the timer set up code from the second counter example in CEdev (Not sure if this is the most efficient way to implement it it was just what I thought of in the given time). Any help is definitely welcome! Thank you in advance.
Code:
Code:
void runGame(){
bool playing = true;
bool key, prevKey;
generateMoves();
while(playing){
int i;
showComputerLights(curMove);
for(i = 0; i < curMove; i++){
timer_Control = TIMER1_DISABLE;
timer_1_ReloadValue = timer_1_Counter = 32768;
timer_Control = TIMER1_ENABLE | TIMER1_32K | TIMER1_0INT | TIMER1_DOWN;
/*
ADD CODE HERE
*/
}
playing = false;
}
}