在同一精灵上运行其他操作时,是否有方法暂停SKSpriteNode中的某些操作?
您可以使用键运行操作,如下所示:
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
}