Run two SKActions at once

前端 未结 2 876
梦毁少年i
梦毁少年i 2020-12-29 22:20

I\'m using a sequence to run a list of SKActions. What I want to do however, is run an SKAction, then run two at once, then run one in sequence.

Here is my code:

2条回答
  •  长情又很酷
    2020-12-29 22:39

    A example in Swift would be:

        let textLabel = SKLabelNode(text: "Some Text")
    
        let moveTo = CGPointMake(600, 20)
    
        let big = SKAction.scaleTo(3.0, duration: 0.1)
        let med = SKAction.scaleTo(1.0, duration: 0.3)
        let reduce = SKAction.scaleTo(0.2, duration: 1.0)
        let move = SKAction.moveTo(moveTo, duration: 1.0)
        let fade = SKAction.fadeOutWithDuration(2.0)
        let removeNode = SKAction.removeFromParent()
        let group = SKAction.group([fade, reduce])
    
        let sequence = SKAction.sequence([big, med, move, group, removeNode])
    
        self.addChild(textLabel)
        textLabel.runAction(sequence)
    

提交回复
热议问题