O'Reilly logo

Learn SpriteBuilder for iOS Game Development by Steffen Itterheim

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

Chapter    3

Controlling and Scrolling

Most games need some way to control the player character. You’ll learn to use Cocos2D actions to move the player through the level you designed. Due to this project’s levels being larger than the screen, and to add the impression of depth to the world, you’ll also implement parallax scrolling as well.

Touch and Go: Moving the Player

The first order of business is to add code that reacts to touch events. You’ll use that to move the player around. To do so, you first have to establish a reference to the player node in the GameScene class.

Finding the Player Node by Its Name

In the GameScene.m class, add the brackets and variable declarations of Listing 3-1 just below the class’ @implementation section.

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