Type Method

positionX:Y:

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

Declaration

+ (instancetype)positionX:(SKRange *)xRange Y:(SKRange *)yRange;

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

Creating Position Constraints

Create a position constraint and add it to a node.

+ positionX:

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

+ positionY:

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