I. Addchild
virtual void Addchild (node * child, int localzorder, int tag) adds a sub-node to the container, with a z-axis order and a marker.
1. If a child node is added to a "running (active)" node, then ' OnEnter ' and ' onentertransitiondidfinish ' will be called immediately.
2. Parameter resolution
AddChild: Refers to the child member to be added (Node * type, removable sprite, layer, etc.);
Z: Refers to the added ZOrder value, ZOrder refers to the member's level (or depth), the z-value of the member in the small Z-value above the member,
Tag: Refers to the member's tag value, the tag value is a member of the identity, if you lose the variable, you can use Getchildbytag (tag) to find this member.
3. Example
Bulletbox->addchild (bullet, 0, Gamescene::hero_bullet_tag);
Gamescene::hero_bullet_tag is a value in an enum, which is 102
Two. RemoveChild
virtual void removechild (Node * child, bool cleanup) removes a kid from the container, depending on the cleanup parameter, and may erase all active actions.
1. Parameter resolution
Child node to which you want to be deleted.
Cleanup to True indicates that all actions and callbacks on this node will be deleted and false will not be deleted.
Analysis of parameters of Addchild and RemoveChild methods in Cocos2d-x