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

Loading Targets and Bumpers from a Layout File

It’s time to build the other elements of classic pinball games: rectangular bumpers that block and repel the ball when hit, and circular targets that also repel the ball but add points to the player’s score.

Up to this point, we’ve been hard-coding all of our node positions. For a pinball game, you might want to have different layouts for the player to choose from—each with its own unique challenge. Let’s solve that by giving the table node the power to load layouts of targets and bumpers from configuration files.

Specifically, we’re going to use the property list, or plist, format which is Apple’s standard storage mechanism for simple arrays and dictionaries of values. Xcode includes a nice plist ...

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