References http://cn.cocos2d-x.org/doc/cocos2d-x-3.0/d3/d82/classcocos2d_1_1_node.html
The member functions associated with child and parent are as follows:
Children and Parent |
virtual void? |
AddChild? (Node?*child) |
|
Joins a child node into the container. Z-order is 0.? Many other ...
|
|
virtual void? |
AddChild? (node?*child, int localzorder) |
|
Add a child node to the container, and the number of references has a local z-axis order. Many other ...
|
|
virtual void? |
AddChild? (node?*child, int localzorder, int tag) |
|
Joins a child node into the container, with a z-axis order and a marker. ? A lot of other ...
|
|
Virtual? Node?*? |
Getchildbytag? (int tag) |
|
Gets a child node from the container through its markup.? Many other ...
|
|
Virtual? vector<? node?* > &? |
GetChildren? () |
|
Returns an array of child nodes.
|
|
Virtual const? vector<? node?* > &? |
GetChildren? () const |
|
Virtual?ssize_t? |
Getchildrencount? () const |
|
Returns the total number of child nodes? A lot of other ...
|
|
virtual void? |
SetParent? (node?*parent) |
|
Set parent node sets the parent, node? Many other ...
|
|
Virtual? Node?*? |
GetParent? () |
|
Returns a pointer to the parent node. Many other ...
|
|
Virtual const? Node?*? |
GetParent? () const |
|
virtual void? |
Removefromparent? () |
|
Removes a node from a parent node. There is a cleanup number of references. Assuming that the node is an isolated node, nothing happens. Many other ...
|
|
virtual void? |
Removefromparentandcleanup? (Bool?cleanup) |
|
Delete a node from the parent node it is assumed that this node is a lone node. Then nothing is going to happen. ? A lot of other ...
|
|
virtual void? |
RemoveChild? (Node?*child, Bool?cleanup=true) |
|
Deleting a child from a container depends on the action of the cleanup to clear all activities at the same time. Many other ...
|
|
virtual void? |
Removechildbytag? (int tag, bool?cleanup=true) |
|
Removes a child from a container by marking the value. Depending on the cleanup, the action of all activities will be cleared at the same time. Many other ...
|
|
virtual void? |
Removeallchildren? () |
|
Remove all children from the container with a cleanup.? Many other ...
|
|
virtual void? |
Removeallchildrenwithcleanup? (Bool?cleanup) |
|
Removing all children from the container, depending on the cleanup, will clear all active actions at the same time. Many other ...
|
|
virtual void? |
Reorderchild? (node?*child, int localzorder) |
|
Once again for a child, set the value of a new z-axis. Many other ...
|
|
virtual void? |
Sortallchildren? () |
|
Before painting, arrange the entire array of children once, rather than sorting each time you join or delete a child node. This method can improve the performance greatly. Many other ... |
In
detail how to use I also in the study. But it is more practical to pass this. You can call the node, a node tree in the game at random a bit node object can be obtained through this method, convenient game development.
Give me a sample.
For example, a parkour game scene has three layers (animations, backgrounds, fractions) in which the animation layer state changes. There is a logical need for a fractional layer to make a corresponding change. The child and Parent methods enable very high-speed positioning to the score layer.
"The Learning experience of node class GetParent and Getchildbytag () in COCOS2DX"