SKAction Completion Handlers; usage in Swift

前端 未结 3 1230
情书的邮戳
情书的邮戳 2020-12-17 18:27

I\'m new to Swift and SpriteKit. A lot of the samples of SpriteKit Actions are in Objective C, which I can\'t map to, nor get working, in Swift.

If running an SKAct

3条回答
  •  佛祖请我去吃肉
    2020-12-17 19:15

    Found an issue here:

    spaceManDeathAnimation = SKAction.repeatAction(SKAction.animateWithTextures(textures, timePerFrame: 0.15625), count: 1)
    

    Also,as sangony posted a very nice link - solved the completion block syntax to

        spaceMan.runAction(spaceManDeathAnimation, completion: {() -> Void in
            println("death")
        })
    

    Very big thanks to everybody for contributions for a solution!

提交回复
热议问题