Ray's learn cocos2d notes (1)

Source: Internet
Author: User

Recently I started to learn cocos2d and read Ray wenderlich's book. This person has his own website and has assembled a group of people to write tutorial on iOS (and other platforms now.

Read the first six chapters and summarize what you have learned for future study.

2012-06-20 17:06:00

It is a concept applicable to the compilation of games in cocos2d.

    • Gamescene: game scenario. For example, if your game has two levels, each level should be a game scenario.

    • Gamelayer: game layer. The game scenario can contain several layers, and the application of the layer makes it easier to control the game. For example, if the game background is a single layer, it will not conflict with the game character layer and be easier to manage.

    • Ccsprite: genie. Game figures and items can all be genie.

Just like a movie, the game also needs to refresh the interface at intervals, usually using the update method in the layer to control the ccsprite object refresh. The layer usually controls the status changes of ccsprite through protocol and delegate. Protocol is designed to reduce the coupling between layer and Sprite, so as to facilitate the increase and decrease of Sprite and improve the reusability of Sprite. The State modification of ccsprite is usually done by changing the state machine. You can set the operations and animations in different States, and under what circumstances the sprite enters another state.

The above is the Framework Structure of cocos2d development games that I personally understand. Scene, layer, and sprite should be the three major protagonists. In addition, spritebatchnode is often used in layer to add Sprite, in order to save memory and faster rendering. The mechanism here is enough to write a long story. Here we will go over it first, and I will write my thoughts later.

The next step is the design of various sprite systems. We have to say that the design process of Sprite is an excellent experience to understand and practice object-oriented systems. In the example in the book, the figures, enemies, and item (item) models are abstracted. The truth is similar to that in the book on the market, but it still requires more practical experience.

 

In addition, the first six chapters also involve the following important concepts:

    • Ccspritebatchnode: Create resource files and file naming rules for resources such as iPad, iPhone, and iPhone retina.

    • Animation: add an animation. design the animation and make it into a plist file.ProgramRead call

    • Collision Detection: it does not involve physical models, such as rigid bodies. It mainly refers to the position of Sprite. Here, you need to remove the blank area near sprite to obtain relatively accurate results.

    • Text: add text to help debugging and create a font resource file for the program.

 

If there are any errors, please criticize and correct them.

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.