tags:

views:

194

answers:

1

I have this game where balloons are coming from bottom and player has to pop them by tapping before: Time runs out

OR

10 balloons leave screen unpopped e.g. game over.

Every level is same , only thing changes is number of balloons.

For this i have the following view controllers:

MainLevelVC: The first one, to which the BaloonPopViewController connects when user selects to play game.

LevelIntroVC: This shows an intro screen for 2 seconds for each level, basically an image is loaded based on level count e.f. 1.png, 2.png etc

LevelOutroVC: similar as before but shows an outro screen. 1_outro.png etc

LevelPlayVC: This is where game logic is actually implemented. a link to Main menu (Play, high scores, etc) exists here.

I have done it for one level, there are global variables (basically implemented via a singleton) in MainLevelVC that define max number of balloons allowed to leave screen unpopped (leftBalloons) and number of balloons in the next level (balloonCount). At the end of every level i have to increment the LevelCount global variable as well to facilitate the Level*troVC to do their task easily.

What i am confused about is how to proceed at the end of every level? after i show the LevelOutro for that level increment/decrement any values that i must, how can i reconnect back to LevelIntroVC to start next level?

+1  A: 

How are you displaying the view controllers in the first place? If you're using a navigation controller, you can just popToViewController:animated: to get back to your intro VC.

Otherwise, you can probably just keep stacking intro VCs on top of outro VCs in the same way you're currently transitioning from intro VC to play VC to outro VC. Just be careful of your memory usage - release any "old" view controllers you're no longer accessing as soon as you can.

Tim