Continue Learning Cocos2dx3.2! I. Cocos2dx3.2 time code folding developed in. C is not as direct as C #. # region can be folded. Du Niang, Google, found this: # pragmaregionname # pragmaendregion! 2. obtain all the genie autospthis-getChildren () at the current layer.
Continue Learning Cocos2dx3.2! I. Cocos2dx 3.2 era code folding developed in. C is not as direct as C #. # region can be folded. Du Niang, Google, found this: # pragma region name # pragma endregion! 2. Get all the genie auto sp = this-getChildren () at this layer; // get this layer
Continue Learning Cocos2dx3.2!
I. Cocos2dx 3.2 era code folding developed in.
C ++ is not as direct as C # region can be folded, so it is very distressing.
Du Niang Google found that:
#pragma region name #pragma endregion
Great!
2. obtain all the genie at the current Layer
Auto sp = this-> getChildren (); // obtain all the children in this layer, that is, all the genie.
A complete method to get all the genie at the current layer and move all the genie down:
VoidSecond: myupdate (float f) {// note that there is a float f parameter auto sp = this-> getChildren (); // obtain all the children in this layer, that is, all the genie. For (auto a: sp) // similar to the iterator traversal, you can change it to for (auto a = sp. begin ();! = Sp. end (); a ++) {}{ a-> setPosition (a-> getPosition (). x, a-> getPosition (). y-2 );}}
Iii. Switching scenarios
There are two switchover modes: replacescene and pushscene.
The difference between the two switching modes is that the former releases the current scenario, and the latter pushes the current scenario into the stack for storage. To switch back the pushscene scenario, you only need to call popscene in the sub-scenario. It is equivalent to suspending the original scenario for a while.
There is a problem here. Please remember: PopScene is invalid when it comes back.
Iv. method error"The overloaded member function is not found".
1. check whether it is declared in. h.
2. Check whether the method is cocos2d ::.
3. above 2, if # include "cocos2d. h" in. h hasUSING_NS_CC, Do not add cocos2d ::.