Pause an SKAction in Spritekit with Swift

前端 未结 3 1683
既然无缘
既然无缘 2021-01-02 07:10

I have the following code to move an SKSpriteNode.

let moveDown = SKAction.moveBy(CGVectorMake(0, -120), duration: 1)
let moveUp = SKAction.move         


        
3条回答
  •  生来不讨喜
    2021-01-02 07:19

    An alternative to @Whirlwind 's answer, in case you have a bunch of actions that need to be paused that are not in a group and not just the movement, is to just pause the node itself. All SKNodes have a paused property associated with it.

    Ex. square.paused = true

提交回复
热议问题