After CGPath with SKAction, not starting at the beginning of CGPath

I have an SKShape node, which is an ellipse. The player is placed at the current point of the Bezier path, which is based on the CGPath ellipse:

enter image description here

I have two actions that the node player can perform. The player can follow the path clockwise or counterclockwise.

rotateCounterClockwiseAction = SKAction.followPath(counterClockwisePath.CGPath, asOffset: false, orientToPath: true, duration: 1)
rotateClockwiseAction = SKAction.followPath(clockwisePath.CGPath, asOffset: false, orientToPath: true, duration: 1)

When I run one of the actions:

player.runAction(SKAction.repeatActionForever(rotateClockwiseAction), withKey: "ClockwiseRotation")

The player moves along the appropriate path and direction. When I stop one of the actions:

player.removeActionForKey("ClockwiseRotation")

, . , , , ( , ), , , . , ?

+4
1

, speed SKNode.

, . .

// Set the player node speed to 0.0 causing all actions to be paused.
[playerNode setSpeed:0.0];

...

// Then when you're ready to resume set the player node speed back to 1.0.
// This will cause the action to continue from its current position.
[playerNode setSpeed:1.0];
0

Source: https://habr.com/ru/post/1544672/


All Articles