Layer

Layers are container objects to which sprites, cameras or other layers can be attached as child nodes. Child nodes have positions relative to the origin or center of the parent layer. The center of a layer is the origin point (0, 0) where the x-axis values increase from left to right and the y-axis values increase upwards. Changing the position of a layer automatically moves all of its descendents.

Figure 1: Example layer containing some sprites

Adding a child node to a layer increases the child's reference count by one. The child's reference count will be decremented only when the parent layer is destroyed or when explicitly removed via the "remove_child" method. Child nodes can only have a single parent, so the same sprite cannot be parented by two layers simultaneously.