Game Development Reference
In-Depth Information
Chapter 7
Scrolling with Joy
Continuing with the beginnings of the game from Chapter 6 , you'll now turn it into
something resembling an actual shoot-'em-up game. The very first thing will be to make
the player's ship controllable. Accelerometer controls don't make sense in this case; a
virtual joypad would be much more appropriate. But instead of reinventing the wheel,
you'll use a cool source code package called SneakyInput to add a virtual joypad to this
cocos2d game.
Moving the player's ship around is one thing. You also want the background to scroll, to
give the impression of moving into a certain direction. To make that happen, you'll im-
plement your own solution for parallax scrolling, because CCParallaxNode is too
limited—it doesn't allow an infinitely scrolling parallax background.
In addition, in this chapter I illustrate what you've learned about texture atlases and
sprite batching in Chapter 6 . There's one texture atlas containing all the game's graphics
because there's no need to group the images separately when using a texture atlas.
Advanced Parallax Scrolling
Because CCParallaxNode doesn't allow infinite scrolling, for this shooting game
you'll add a ParallaxBackground node, which does just that. Moreover, it uses a
CCSpriteBatchNode to speed up the rendering of the background images.
Creating the Background as Stripes
Search Nedrilad ::

Custom Search