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

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.