#17860 - darknet - Tue Mar 16, 2004 4:20 am
Alright, I have a dilemma (As usual right?), I was weeding through the threads and came to the countdown thread. While the info there really helped me, it also opened up a number of questions. Here goes:
My project consists of a number of timed mini-games. For example, a person will have 30 seconds to complete a mini-game. If 30 seconds go by, a screen pops up showing that time is up. Think WarioWare MicroGames.
In any case, if the person does finish the game, I do not want the timer stuff to appear at all obviously. Otherwise, when time runs out, display the message.
The way I have it set up right now, If i run my timer function, nothing else is allowed to run concurrently, i.e. the system just waits till time is up and displays the message, not allowing for any other interaction.
How should this kind of thing be structured / accomplished? I read the countdown timer thread and came up with this function,
where vBlank() is defined as so:
For testing purposes, I am just calling that function in random places throughout different mini-games, however nothing allows the game control and the timer to coexist. In addition, how would I give control back to the main program once the timer is up and the screen is displayed?
Sorry for the long winded post, thanks for reading + any answer is appreciated.
My project consists of a number of timed mini-games. For example, a person will have 30 seconds to complete a mini-game. If 30 seconds go by, a screen pops up showing that time is up. Think WarioWare MicroGames.
In any case, if the person does finish the game, I do not want the timer stuff to appear at all obviously. Otherwise, when time runs out, display the message.
The way I have it set up right now, If i run my timer function, nothing else is allowed to run concurrently, i.e. the system just waits till time is up and displays the message, not allowing for any other interaction.
How should this kind of thing be structured / accomplished? I read the countdown timer thread and came up with this function,
Code: |
void setAndRunFor(int amountOfTime) { //set up a frame variable (=60) unsigned short frame = 60; //Every VBlank, decrement a 'frame' counter. while(amountOfTime!=0) { for(int i = frame; i>=0; i--) { vBlank(); } amountOfTime--; frame = 60; } //draw the time is up graphic here setMode(MODE_3 | BG2_ENABLE); drawMode3Background(videoBuffer, timesUp_Bitmap); } |
where vBlank() is defined as so:
Code: |
void vBlank() { while(REG_VCOUNT != 160); } |
For testing purposes, I am just calling that function in random places throughout different mini-games, however nothing allows the game control and the timer to coexist. In addition, how would I give control back to the main program once the timer is up and the screen is displayed?
Sorry for the long winded post, thanks for reading + any answer is appreciated.