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

Adding Bonus Points with a Spinner

Bumpers and bouncy targets are fun, but we’d like to add another kind of element to the pinball table for the player. We’re going to build a spinner that is activated when the ball passes through it. While the spinner is rotating, targets are worth three times their normal point value—it’s a bonus mode! As the spinner slows to a stop, the bonus mode deactivates. If the player can keep the spinner in motion, the points will just keep piling up.

To do this we’ll need to build a new node subclass and lay it out on the table in the property list configuration file we set up back in Loading Targets and Bumpers from a Layout File. We’ll also use a new technique when detecting body contact with the physics engine. ...

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