有没有办法在同一 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/