Application of layer in cocos2d-x

Source: Internet
Author: User

A Layer is used to present a specific object in a centralized manner. Generally, several layers are added to Scene to manage an activity. At this time, the layer carries the meaning of a container, and what should be drawn in this layer. The container also has other elements such as node, so here layer is an important role, the coordinate system. The coordinate system is global. Therefore, this key point is the basis for manipulating collision detection between multiple layers. When designing a game, you need to figure out which genie are drawn in which layer. Therefore, the layer is added to scene and will be used in many later logics. Therefore, there must be a method in scene to obtain this layer.1. It is very convenient to obtain scene through static methods. But note that scene requires a static variable to save and release it. 2. Think of scene as a context. All related parties need this context. This is in line with the design philosophy of the vast majority of UI frameworks. The context must be passed when the code is more complex.

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.