Tutorial by Examples

A very simple example would be to fade out an SKSpriteNode. In Swift: let node = SKSpriteNode(imageNamed: "image") let action = SKAction.fadeOutWithDuration(1.0) node.runAction(action)
Sometimes it is necessary to do an action on repeat or in a sequence. This example will make the node fade in and out a total of 3 times. In Swift: let node = SKSpriteNode(imageNamed: "image") let actionFadeOut = SKAction.fadeOutWithDuration(1.0) let actionFadeIn = SKAction.fadeInWithD...
One helpful case is to have the action run a block of code. In Swift: let node = SKSpriteNode(imageNamed: "image") let actionBlock = SKAction.runBlock({ //Do what you want here if let gameScene = node.scene as? GameScene { gameScene.score += 5 } }) node.runActi...
Sometimes you would want to start or remove an action on a specific node at a certain time. For example, you might want to stop a moving object when the user taps the screen. This becomes very helpful when a node has multiple actions and you only wants to access one of them. let move = SKAction.mov...

Page 1 of 1