Type Method

positionX(_:y:)

Creates a constraint that restricts both coordinates of a node’s position.

Declaration

class func positionX(_ xRange: SKRange, y yRange: SKRange) -> Self

Parameters

xRange

The range to restrict the x-coordinate to.

yRange

The range to restrict the y-coordinate to.

Return Value

A new constraint.

Discussion

Each time constraints are applied, the node’s position property is clamped so that both coordinates lie inside the specified ranges.

See Also

Creating Position Constraints

class func positionX(SKRange)

Creates a constraint that restricts the x-coordinate of a node’s position.

class func positionY(SKRange)

Creates a constraint that restricts the y-coordinate of a node’s position.