SKAction.repeatForever . stop(remove)

Hi.
Can i stop(remove ) SKAction.repeatForever . but with finish sequence !
If sequence have ADD, MoVE, REmove - stop not in random place stop with finish sequence.

Hi @archideus

You can add an action with block to your sequence and check there some flag that determines if sequence should stop. Something like this should work:

var sequenceShouldStop = false
/////

let blockAction = SKAction.runBlock {
   if sequenceShouldStop
   {
      yourNode.removeActionForKey("repeatForeverActionKey")
   }
}

let sequence = SKAction.sequence([moveAction1,moveAcion2,blockAction])

Hope this is helpful.

Nikita

1 Like

This topic was automatically closed after 166 days. New replies are no longer allowed.