I am trying to make a repeating task where I can change the delay in which it repeats. Here is the current code I am using:
var actionwait = SKAction.waitForDuration(self.wait)
var actionrun = SKAction.runBlock({
self.count+=1
if (self.count % 2 == 0 && self.wait > 0.2){
self.wait -= 0.1
actionwait.duration = self.wait
}
for node in self.children{
if (node.isMemberOfClass(Dot)){
node.removeFromParent()
}
}
var radius = CGFloat(arc4random_uniform(100) + 30)
var newNode = Dot(circleOfRadius: radius)
var color = self.getRandomColor()
newNode.fillColor = color
newNode.strokeColor = color
newNode.yScale = 1.0
newNode.xScale = 2.0
newNode.userInteractionEnabled = true
newNode.setScene(self)
newNode.position = newNode.randomPos(self.view!)
self.addChild(newNode)
})
self.runAction(SKAction.repeatActionForever(SKAction.sequence([actionwait,actionrun])))
However, it appears that because the sequence is already repeating, changing the duration of the delay does not effect anything.