Instance Method

move(toParent:)

Moves the node to a new parent node in the scene.

Declaration

func move(toParent parent: SKNode)

Parameters

parent

An SKNode object to move the receiver to. This node must be in the same scene as the node’s current parent.

Discussion

The node maintains its current position in scene coordinates.

See Also

Working with Node Trees

func addChild(SKNode)

Adds a node to the end of the receiver’s list of child nodes.

func insertChild(SKNode, at: Int)

Inserts a child into a specific position in the receiver’s list of child nodes.

func isEqual(to: SKNode)

Compares the parameter node to the receiving node.

func removeFromParent()

Removes the receiving node from its parent.

func removeAllChildren()

Removes all of the node’s children.

func removeChildren(in: [SKNode])

Removes a list of children from the receiving node.

func inParentHierarchy(SKNode)

Returns a Boolean value that indicates whether the node is a descendant of the target node.

var children: [SKNode]

The node’s children.

var parent: SKNode?

The node’s parent node.

var scene: SKScene?

The scene node that contains the node.