I am trying to implement the following functions in my game. I run an action on a node sprite (sprite node parent is nil) and the action should wait for my specified time and then add the node to itself. I could not find any action that adds node to the parent. I was thinking of doing something like this:
node.runAction(SKAction.sequence([SKAction.waitForDuration(timetowait), SKAction.runBlock(addToSelf(node))]))
and just having a method like this:
func addToSelf(node: SKSpriteNode){
self.addChild(node)
}
If I manage to do this, game performance will improve. Does anyone know if there is work around?
source
share