September 2018
Intermediate to advanced
434 pages
8h 47m
English
Before we dive back in to sprite theory, we should have some fun with our blue square. SpriteKit uses action objects to move sprites around the screen. Consider this example: if our goal is to move the square across the screen, we must first create a new action object to describe the animation. Then, we instruct our sprite node to execute the action. I will illustrate this concept with many examples in the chapter. For now, add this code in the didMove function, below the self.addChild(mySprite) line:
// Create a new constant for our action instance // Use the move action to provide a goal position for a node // SpriteKit will tween to the new position over the course of the // duration, in this case 5 ...
Read now
Unlock full access