#18574 - darknet - Mon Mar 29, 2004 2:57 am
Here Goes:
I (for those who haven't helped me before) am making a game full of TIMED mini-games, in the vein of warioware microgames (but not that frantic!)
I have 2 games complete (of 4 or 5), but the main driver (main.cpp) is not functioning properly.
Basically, when a player beats a mini-game or time runs out on a mini-game, I want to the user to be transported back to the main menu. With my structure however, I cannot find a clean or good or working way to do this.
Each mini-game is completely self-contained and the all of the game code goes in a startGame() function (i.e. Breakout has void startBreakout() ). I have the user play the games until time either runs out or they complete the game. The main.cpp driver has a loadMiniGame function that does the following:
As of right now, once the mini-game ends the entire program halts and goes nowhere. I tried throwing in other cases within each to no avail. I even have a getState function within each game that gets the final state. No dice when I tried getting the state within the above code and checking if it was a certain value.
I hope this question makes sense. I suppose in an abstract manner the question is how the main driver can regain control of the program once the mini-game halts. Seems easy enough, but been having the worst time getting something going.
Any help is appreaciated + thanks alot for reading.
I (for those who haven't helped me before) am making a game full of TIMED mini-games, in the vein of warioware microgames (but not that frantic!)
I have 2 games complete (of 4 or 5), but the main driver (main.cpp) is not functioning properly.
Basically, when a player beats a mini-game or time runs out on a mini-game, I want to the user to be transported back to the main menu. With my structure however, I cannot find a clean or good or working way to do this.
Each mini-game is completely self-contained and the all of the game code goes in a startGame() function (i.e. Breakout has void startBreakout() ). I have the user play the games until time either runs out or they complete the game. The main.cpp driver has a loadMiniGame function that does the following:
Code: |
void loadMiniGame() { drawMode3Background(videoBuffer, menu_Bitmap); current_state = IN_MENU; int previousButton, button, down, up; while(current_state!=QUIT) { button = *BUTTONS ^ 0x03ff; down = button & ~previousButton; //pressed since last loop up = previousButton & ~button; //released since last loop if( (down & A_BUTTON) !=0) { switch(current_state) { case IN_MENU: startTxtAdventure(); break; } } if( (down & B_BUTTON) !=0) { switch(current_state) { case IN_MENU: startBreakout(); break; } } previousButton = button; waitForVSync(); } } |
As of right now, once the mini-game ends the entire program halts and goes nowhere. I tried throwing in other cases within each to no avail. I even have a getState function within each game that gets the final state. No dice when I tried getting the state within the above code and checking if it was a certain value.
I hope this question makes sense. I suppose in an abstract manner the question is how the main driver can regain control of the program once the mini-game halts. Seems easy enough, but been having the worst time getting something going.
Any help is appreaciated + thanks alot for reading.