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

Generating a Parallax Field of Stars

If we put this game in players’ hands today, they’d think the ship was just sitting still while the dangerous asteroids and enemy ships flew past. But the ship is actually zooming ahead at full speed, trying to reach the destination. We need some sort of visual effect to evoke this feeling, and a fast-moving parallax star field will do the trick nicely.

We will implement this by creating our own particle system, which means that we’ll generate and move nodes representing particles around on the screen based on a set of rules. For this effect, our particles are stars, and the rules are that they should travel from the top of the screen to the bottom, some faster than others to give the illusion of depth. ...

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