gpt4 book ai didi

swift - SK.action 多次运行action

转载 作者:行者123 更新时间:2023-11-30 12:49:08 27 4
gpt4 key购买 nike

我有一个 SKAction,如果触摸屏幕上的某个区域,它就会运行一个操作。但是我无法让 SKanimate 仅运行 SKarray 一次(即两个操作),它似乎运行了大约 4 次。 count 参数似乎也没有任何区别。任何关于如何让它运行一次数组中的帧然后停止的帮助将不胜感激!

//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!"
}
}

最佳答案

抱歉 - 解决了。一排有 3 个 Sprite 数组,第一个没有正确关闭并封装了其他两个,这意味着 I in 中的“I”被使用了 3 次!

关于swift - SK.action 多次运行action,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41230195/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com