gpt4 book ai didi

ios - 在 SKSpriteNode 中暂停一项操作,同时运行另一项操作

转载 作者:行者123 更新时间:2023-12-01 19:24:07 26 4
gpt4 key购买 nike

有没有办法在同一 Sprite 上运行其他操作时暂停 SKSpriteNode 中的某些操作?

最佳答案

您可以run action with key ,像这样:

Objective-C

[yourNode runAction:yourAction withKey:@"aKey"];

然后您可以像这样访问该特定操作:

SKAction *action = [yourNode actionForKey:@"aKey"];

if(action){
action.speed = 0; //pause action
}

swift

要使用键运行操作:

yourNode.runAction(yourAction , withKey: "aKey")

暂停操作:

if let action = ball.actionForKey("aKey"){

action.speed = 0

}

关于ios - 在 SKSpriteNode 中暂停一项操作,同时运行另一项操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34177393/

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