Shooting at Asteroids with Simple Motion Actions
We’ll begin by exploring simple motion actions that move nodes around on the screen. Although you know how to change a node’s position in real time in the ‑update: method, which you did with the spaceship back in Chapter 1, Introduction to Sprite Kit, we’re going to use Sprite Kit actions to move the other nodes around on the screen. Any movement that is deterministic with a constant velocity works well as an action because we can just send the nodes on their merry way toward a destination point.
Before we start examining code, we need to make sure that the graphic assets for two new sprite nodes are in the project: the photon torpedo and the asteroid. Remember, you learned how to download ...
Get Build iOS Games with Sprite Kit now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.