During the development of some interactions between different nodes, I realized that I needed to remove a specific list of actions from node. The current version of the Sprite-Kitframework provides some instance methods like:
Obviously, every action performed in my node has a key Stringto identify it. So I thought about what was very similar to removeAllAction, then I did the extension SKNode:
public extension SKNode {
func removeAllAction(in list:[String]) {
list.forEach { if self.action(forKey: $0) != nil { self.action(forKey: $0)?.speed = 0.0; self.removeAction(forKey: $0)}}
}
}
And in my project, I can use it like:
let actionList = ["idle_walk_sx","idle_walk_dx","walk_dx","walk_sx","walk_idle_sx","walk_idle_dx","rotate_sx_dx","rotate_dx_sx"]
self.removeAllAction(in: actionList)
The code works well. But I am not sure of two factors:
speed ( ), ,
. - , ?- ( )
, ?