Animating nodes
Animated pictures give a very dynamic and polished feel during a gameplay; it is always preferred to have animations in our game. To add animations in Sprite Nodes, we can use the
SKAction
class properties and methods, which add the animations to the Sprite Kit nodes. Let's discuss about the SKAction
class in detail.
SKAction
Properties and methods of the SKAction
class help in providing the actions to the nodes in a scene. Actions are used to change the arrangement and appearance of the node to which they are attached. Actions in a node are executed when the scene runs its nodes.
To assign an action we can call the particular SKAction
class method as required. Then, we can configure the properties of the actions. In the end, for the execution of the action, we call the node object's runAction()
method and pass the action's object.
Adding a single action to a node
There are two steps to add a single action to the node:
Creating an action: First of all, we create an action which...