Reputation: 2154
There are two actions to run, one is move the object from pointA to pointB, the other is move the object from pointB to pointC. But when I execute them soon enough, the object will move from pointA to pointC directly.
beed.sprite1.position = A
let moveA = SKAction.moveTo(B, duration: 0.2)
beed.sprite1.runAction(moveA)
let moveB = SKAction.moveTo(C, duration: 0.2)
beed.sprite1.runAction(moveB)
It seems a interesting feature in sprite kit. What should I do so I can execute them step by step, that is, move the object from pointA to pointB, THEN, move it from pointB to pointC?
Thanks,
Upvotes: 2
Views: 104
Reputation: 1062
Adding the actions to an SKAction Sequence would probably be your best bet.
beed.sprite1.position = A
let moveSequence = SKAction.sequence([
SKAction.moveTo(B, duration: 0.2),
SKAction.moveTo(C, duration: 0.2)])
beed.sprite1.runAction(moveSequence)
Upvotes: 2