I want to create and run some SKAction. After the SKAction, the program will print a message.
let actLoop = SKAction.run {
for i in 1 ... 10 {
self.stone[i - 1].position = CGPoint(x: 0 , y: -100)
self.stone[i - 1].anchorPoint = CGPoint(x: 0.5, y: 0.5)
self.stone[i - 1].size = CGSize(width: 50, height: 50)
self.addChild(self.stone[i - 1])
let actionMove = SKAction.move(to: CGPoint(x: 0, y: 0), duration: 0.3)
let actionRolling = SKAction.animate(with: stone[i - 1].arrayTexture, timePerFrame: 0.05)
let actionSequence = SKAction.sequence([actionMove,actionRolling])
stone[i - 1].run(actionSequence)
}
self.run(actLoop) {
print("Completed")
}
The program will not print the "Completed" message at the end but the message will appear about the same time the SKActions are executing. I want the message to appear only after all the SKActions have completed. I also tried this:
self.run(actLoop, completion: {
//
print("Completed")
})
This also did not work. I cannot seem to get this right.