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

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.