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 Scrolling Table with an Edge Body

Pinball wouldn’t be pinball without the familiar curved table design that guides the launched ball up and around. We want to have that same feel, so we’re going to build a special kind of physics body, called an edge body, that will act as the walls of the table.

But more than that, we want this table to be taller than the screen and scroll to keep the ball centered. That means we need a node to contain the ball, the plunger, and all the other nodes that belong to the game. We’ll reposition that special node representing the table to give the illusion of a camera following the ball.

We’ll start by creating a new file named RCWTableNode.h with this class interface:

06-Physics/step12/PhysicsBall/RCWTableNode.h ...

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