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

Building a Game-Ending Sequence

Remember when we first implemented the ‑endGame method on our game’s RCWMyScene class? As soon as the ship explodes, we immediately transition back to the menu. That’s too abrupt. Instead, let’s show a consoling “Game Over” on the screen as the explosion particle emitter dies out and the obstacles continue falling.

While we could build a whole new cutscene to display to the player, that would replace everything going on in the SKView. We’re not going to present a new SKScene instance, because we want the activity that the player left behind on the game scene to continue behind the end-game message. Let’s build a self-contained node that will display the “Game Over” text, animate it into place, and then display ...

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