您可以使用动作序列:
override func didMoveToView(view: SKView) { let sprite = SKSpriteNode(color: SKColor.purpleColor(), size: CGSize(width: 100, height: 10)) sprite.position = CGPoint(x: CGRectGetMidX(frame), y: CGRectGetMidY(frame)) addChild(sprite) let moveUp = SKAction.moveByX(0, y: 200, duration: 2) let sequence = SKAction.sequence([moveUp, moveUp.reversedAction()]) sprite.runAction(SKAction.repeatActionForever(sequence), withKey: "moving") }