Ship Attack! Sample Game
Objective-C M C Other
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

Ship Attack! Sample Game

Game Progamming Algorithms and Techniques
By: Sanjay Madhav


This code is a sample side-scrolling game from my book. While the code contained herein does have some commenting, for a more comprehensive analysis of the code, you should read the corresponding chapter from the book (13).

For any updates to this code, more detailed build instructions, as well as download links to binaries, visit the page for this project on the book's website at:


All the sprites were created by Jacob Zinman-Jeanes: (Used under the CC BY license).

How to Play

Slide a finger along the left side of the screen to move the ship up and down. Hold a finger on the right hand side of the screen to fire. This works best using your left and right thumbs.


The project can only be opened on a Mac with Xcode. I used 4.6.3, but it probably will also work on newer versions.

Open up shipattack.xcodeproj and it will build for iOS without any further steps. If you do not have a Mac, you can still browse the source files that are in the shipattack sub-directory. Note that all of the files under the libs directory are default cocos2d files, and they aren't modified for this project.


The code specific to shipattack is released under the BSD License, which more or less means you can use it for whatever you want to, commerical or not.

Though not required, it would be nice if you gave attribution if you end up using this code in a game of yours. At the very least, I'd love to hear about any games that end up doing so.

I'm not a lawyer, though, so you'll want to read the full file.