After studying Cocos2dx for a month, I finally built the project, mainly because some development tools are difficult to find, but I have no choice but to
Today, I heard some great gods say that the Node node is the core of Cocos, similar to Java's Object
: Nodes are the basic elements of the scene graph. The basic element of the scene graph must be a node object or a subclass of a node object. Some common node objects: Scene, Layer , Sprite , Menu , Label .
The main characteristics of a node:
- They can contain other node objects (
addChild
,getChildByTag
,removeChild
, etc) - They can schedule periodic callbacks (
schedule
,unschedule
, etc) - They can perform some actions (
runAction
,stopAction
, etc)
A subclass node usually means (single/all):
- Override initialization resources and can schedule callbacks
- Create callbacks for when the operation takes place
- Override "draw" to render nodes
Properties of the node:
- position (default: x=0, y=0) position
- zoom (default: x=1,y=1) zoom
- rotate (in degrees, clockwise) (default: 0) rotate
- anchor point (default: x=0, y=0) anchor
- Content size (default: width=0,heigh=0)
- visibility (default: true)
Limitations: Limitations:
- A node class is a "void" object. If you want to draw something in the scene, you should use the sprite class instead. Or subclass Node and override "draw".