Cocos2dx3.2 start from scratch [3] continue learning Cocos2dx3.2

Source: Internet
Author: User
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 ::.





Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.