runAction(_:completion :)没有正确显示动画

时间:2015-05-05 16:18:55

标签: xcode swift skaction

我想同时运行两个动作,然后同时执行另外两个动作。基本上我想有两组动作并按顺序运行它们。我无法对我的操作进行分组,因此我使用了runAction(_:completion :)函数:

self.orangeQuestionmark.runAction(group, completion: {     
        })
        self.blueQuestionmark.runAction(group, completion: {
            bubbleArray[0].hidden = false
            pony.runAction(ponyMove)
        })

除非此调用,否则此方法正常:

pony.runAction(ponyMove)

通过此调用我调用动画。见代码:

let ponyMove = ponyClass.movingPony("ponyScene3Move1", secondImage: "ponyScene3Move2")


class Pony: SKSpriteNode {
func movingPony(firstImage: String, secondImage: String) ->SKAction{
        let movePony = SKAction.animateWithTextures([SKTexture(imageNamed: secondImage), SKTexture(imageNamed: firstImage)], timePerFrame: 0.4, resize: true, restore: false)
        moving.append(movePony)
        moving.append(SKAction.repeatAction(movePony, count: 6))
        let group = SKAction.group(moving)
        return group

    }

}

然而,当我在runAction(_:completion :)之外运行此函数时,它可以正常工作。

有谁知道我的错是什么?

0 个答案:

没有答案