SK.action多次执行动作

时间:2016-12-19 20:06:39

标签: swift xcode sprite-kit

我有一个SKAction,如果触摸屏幕上的某个区域,它会运行一个动作。但是我不能让SKanimate只通过SKarray一次(这两个动作),它似乎运行了4次左右。计数参数似乎也没有任何区别。任何关于如何让它在阵列中运行一次然后停止的任何帮助都将不胜感激!

//Touch location check
for touch in touches {
    let location = touch.location(in: self)



    if myButton.contains(location) {
        //run shoot animation.

        MainGuy.run(SKAction.repeat(SKAction.animate(with: TextureArrayShoot, timePerFrame: 0.10), count: 1),withKey: "outlaw")

        print ("touched")
        let witchaction = SKAction.animate(with: TextureArrayWitch, timePerFrame: 0.20)
        witch.run(witchaction)


        missedLabel1.text = "Good Shot!"
    }
} 

1 个答案:

答案 0 :(得分:0)

道歉 - 解决了它。连续有3个精灵阵列,第一个没有正确关闭并封装了另外两个,这意味着我在......中的'I'被使用了3次!

相关问题