03. node tree of sprite_kit foresight, 03. sprite_kit foresight

Source: Internet
Author: User

03. node tree of sprite_kit foresight, 03. sprite_kit foresight
Sprite Kit prospective node tree

This article is only a forward looking. You only need to read it with appreciation.

SKSceneClass inherited fromSKNodeClass,SKNodeClass inherited fromUIResponderClass. After talking about the inheritance relationship, let's talk about nodes (Node), When we useSprite KitThe node is the basic building block of all content, and the scenario (sceneObjects Act as node treesRoot NodeRole. The scene and its descendants determine what to draw and how to render it.

In the coordinate system defined by the parent class, the positions of each node are clearly defined. At the same time, a node also applies to other attributes to its own content and its descendant content. For example, when A node is rotated, all its descendants will be rotated. This is easy to understand: for example, an object A acts as the parent class and has several attributes, B inherits A and naturally owns those attributes. However, if Object C inherits B, C will also have several attributes of A because of the inheritance relationship! What is the purpose? For example, we create a compleximageNode (nodeBy adjusting the node attributes on it to rotate, scale, and mix the entire image.

Emphasize:SkNodeClass does not draw anything, but it can pass its own attributes to its descendants. InSprite KitIn the framework, each type of printable content is represented by a specific subclass. Other nodes adjust their attributes to modify their descendants even if they do not draw content. For example, you can useSKEffectNodeClass adds an image filter function to inherit from itsSKSceneClass has this function. By precisely controlling the node tree structure, you can clearly control the node Rendering sequence.

Said,SKNodeClass inherited fromUIResponderOrNSResponderTherefore, as long as it is inherited fromSKNodeAll new classes of the class can receive user input. View (View) Class automatically extends the response chain to add nodes to the node tree of the scenario.

Supplement:
1. What are inherited fromSKNode?
SKLabelNode,SKLightNode,SKSpriteNode,SKVideoNodeAnd so on. View nameLabelIt is used to draw labels,VideoIt is naturally used to draw videos. Is there a feeling of having different jobs? In other words, every kind of things has a different class to draw, and they all inherit fromSKNode.

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.