cocos2d meets MVC – wrap up

This post is going to be short. If you have any questions regarding the previous parts or something is unclear please let me know. I have some contract projects going on (which going to be HUGE!!!) so not so much time for blogging. To wrap up the previous parts:

  1. We implemented the Model which helps us encapsulate the logic of a game that is not polluted with other concerns (like display),
  2. We implemented the Controller that handles the user interaction (and updates the model),
  3. We implemented the View which responsibility is ONLY to display the current state of a model.
The interaction between the components is the following:
  1. The Controller starts the Model and the View,
  2. The View displays the Model,
  3. The View responds to user touches and passes (using delegate) the event to the Controller,
  4. The Controller implements view delegate and reacts by calling the Model,
  5. The Model performs some game logic and notifies the View that its state has changed,
  6. The View updates its objects (like sprites) according to the current state of the Model.
Open questions:
  1. If you were going to implement an “Undo” functionality using NSUndoManager, where would you put your undo calls?
  2. How would you store the state of your current scene?
  3. Others?
Be Sociable, Share!
This entry was posted in idevblogaday, iPhone and tagged , , , , , , , , . Bookmark the permalink. Post a comment or leave a trackback: Trackback URL.

2 Comments

  1. denny prijadi
    Posted January 11, 2012 at 10:31 am | Permalink

    would you be kind enough to give complete source code of this project ? its very helpful to understand the MVC gaming… thanks

Post a Comment

Your email is never published nor shared. Required fields are marked *

*
*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre lang="" line="" escaped="" highlight="">