O'Reilly logo

Build iOS Games with Sprite Kit by Josh Smith, Jonathan Penn

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required