9. When the World Gets Bigger: Adding Scrolling

In the last chapter you learned how to add sound effects and music to Space Viking, giving Ole a heavy metal soundtrack as inspiration to beat the aliens. In this chapter you learn how to make Ole’s world even larger by adding scrolling and creating a second game level and a cut-scene. Scrolling is an easy and powerful technique that can be used to make your levels larger and to add depth to your games.

Let’s take a moment to cover the basics. Up to now the levels have been set to the dimensions of the iOS device screen. On the iPad the alien world is only 1024 × 768 pixels in size. Ole and his enemies cannot move beyond the screen to the left or right. For the background, you are using one large ...

Get Learning Cocos2D: A Hands-On Guide to Building iOS Games with Cocos2D, Box2D, and Chipmunk now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.