暂停 SKSpriteNode 中的一个动作,同时 运行 另一个

Pause one action in SKSpriteNode while running another

有没有办法暂停 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

}