I am working on an Xcode playground in Swift and I would like for a selection of sprites to perform some actions in a set order, one after the other. However they appear to be happening all at once, despite my use of the completion handler.
Any while loops I try (using a boolean to see if the action is completed or not - set to true in the completion handler) result in an infinite loop.
Here is a code I've tried:
centreOfRotation.run(SKAction.rotate(byAngle: CGFloat(degreesToRadians(angleInDegrees)), duration: 5), completion: {
finished = true
print("finished")
})
But this code doesn't wait for completion before going to the next line.
Does anyone know how to stop this? Thanks.