basic concepts

1. Scene and process control

Usually, a collection of game elements whose content is relatively unchanged is called a scene .

The process of switching the game between scenes is called flow control .

In Cocos2d-x, the implementation of the scene is CCScene.

2 layer

Menu layer: various menu items floating at the top

Touch Layer: Handles touch and click events on the screen

Action layer: place fish, bullets, nets, etc., and handle collisions

Background Layer: Background Image

In Cocos2d-x, the layer's implementation is CCLayer

3. Elf

The sprites belong to the layer. It can be said that almost everything the player sees is composed of sprites.

4. Nodes and Render Trees

In order to draw the scene, you need to draw the layers in the scene, and in order to draw the layers, you need to draw the sprites in the layers. Therefore, the relationship diagram essentially arranges the drawing method of the primitives. Each element in the relationship diagram is called a node , and the relationship diagram is called a rendering tree . The process of rendering a scene is the process of traversing the render tree.

5. Action and animation

In Cocos2d-x, actions are implemented by the CCAction class, and the continuous action CCACtionInterval and the instantaneous action class CCActionInstant are derived from the CCAction class. All actions are derived from one of the above two classes.

In Cocos2d-x, we can use multiple frames to create a frame animation sequence (CCAnimation), and use the frame animation sequence to create a frame animation (CCAnimate) that can be used as a sprite.

Make a whimper. . . Why is the efficiency so low today, why is the efficiency so low today, why is the efficiency so low today. . . There are still 12 days to hand in the code, what should I do ( T__T ) Heartbroken

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325220900&siteId=291194637