To fire the cannons, we’ve created a sequence of actions that alternates between waiting and firing. We embed the fire/wait sequence in another action, one that is repeated forever.
To execute an action on a node, we simply call its runAction
function and pass it the action of interest. Multiple actions can be executed simultaneously by a node, making it easy to implement complex, custom behavior in SpriteKit.