How to Implement MVC in cocos2d (6)

Source: Internet
Author: User

This article will be brief. If you have any questions about how to implement MVC in cocos2d in the previous articles, please tell me so that I can add more details. I (original author) recently took some very large outsourcing projects, so I didn't spend much time writing blogs. Here, I will briefly summarizeArticle:

  1. We have implemented the model, which can help us encapsulate the game logic, so that our focus is on the game logic, rather than other (such as rendering)
  2. We implemented the Controller to process user interaction and update the Model accordingly.
  3. We have implemented the view, and its responsibility is only to display the status of the model.
The interaction between the three is as follows:
  1. The Controller initializes the model and view.
  2. View is responsible for displaying Model
  3. View is responsible for receiving user touch events and passing them to the Controller for processing.
  4. The Controller implements the view proxy and can operate the model.
  5. The model executes some game logic processing and notifies the view of its state changes.
  6. View updates all objects in a model based on its current state, such as genie.
Leave a few open questions:
  1. If you want to use nsuodomanager to implement the "undo" function, where will you place this function? Model? Controller? View?
  2. How do you save the status information of the current scenario?
  3. Or can you add other questions?

 

Note: This article has been synchronously updated to the cocos2d MVC series.

If you think this article is helpful to you, please click the "recommendation" button next to it so that more people can see it and give me the motivation to write, thank you.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.