Reputation: 41
I have a function which create a sequence of actions. After this function, an other function is called with another sequence as well.
I would like to call the second function when the actions of the first function are completely terminated.
I tried some solutions with a "Do.. While" but it doesn't work because it stops the action.. I don't know by the way.. I tried to use semaphore but it doesn't work as well.. I tried to use "completion" in action and put my second function in but it doesn't work...
So I am lost, I don't know how to do.. A thing I know also is the duration of the sequence so maybe there is a solution to wait this duration until to launch the second function.. ?
Could you help me please ?
Upvotes: 0
Views: 1247
Reputation: 41
I am talking about moveTo action. In fact, I would want to finish a moveTo action before to call a function after that..
Here is the code:
self.fct_utils.direction = false
coord_b = self.verifyAngle()
let wait = fct_move.nodeWaitForDuration(1)
let action = fct_move.nodeMoveTo(backTime, coord_x: coord_b.x, coord_y: coord_b.y)
let sequence = SKAction.sequence([wait, action, wait])
robot.runAction(sequence)
And I would to finish this sequence before to call the next line which is :
self.fct_utils.direction = true
Upvotes: 2