Game Development Reference
In-Depth Information
Chapter 13. Sample Game: Side-Scroller for iOS
A side-scroller is a game where the action is viewed from the side. An
endless scroller is a variation in which the game world continues to
scroll until the player loses. An example of a very popular endless
scroller is
Jetpack Joyride
.
In this chapter, we take a look at a sample implementation of a 2D
space-based endless scroller called
Ship Attack
. The code for this game
was written in Objective-C using the cocos2d framework, and is for iOS
devices.
Overview
This chapter is intended to be read while reviewing the source code for the game,
whichisavailableonthe topic 'swebsiteat
http://gamealgorithms.net/source-code/
shipattack/
.
Because this game is for iOS, in order to run the code you need a Mac
(running Mountain Lion or higher) as well as Xcode (which can be downloaded
for free from the App Store). The code unfortunately cannot be tested on a Win-
dows machine.
The control scheme for
Ship Attack
is fairly simple. Hold the iPhone horizontally
and slide your left thumb up and down on the left part of the screen in order to
move the ship. To fire, hold down your right thumb on the right part of the screen.
The objective of the game is to avoid enemy projectiles while destroying them
with your lasers.
The sprites for
Ship Attack
were created by Jacob Zinman-Jeanes and are used un-
der the CC-By license. A link to the sprites is provided on the topic's website.
These sprites were packed into a sprite sheet using TexturePacker. For more in-
ics
.”
Now, before we review the source code in detail, let's first take a look at the tech-
nologies used to create
Ship Attack
, shown in
Figure 13.1
.