I am new to develop iPhone games, infact game development. and I wonder, what is the most common strategy of restart a game?
- Have reset functions in the gameViewController and call it?
- Is there a fast way to just restart the controller?(but have to ensure my navigation dismiss method works when quit game to menu as well)
Which one is more sufficent?
Another other better suggestions would be great !
I would have a separate gameController object that does all the game setup in init, and only uses the controller for display. When you want to reset the game, allocate a new gameController object and connect it to the view in place of the old one. Running your game logic directly from the viewController isn’t usually a good idea because you may still want the view and not want the game – better to separate them into discrete objects.
To visualize:
Restart: eliminate only [Game Controller] and create a new one.