5 Cocos2D iPhone Game Source Code Kits to Revolutionize Your Game Development

Writing a game can be tough work. Seriously. All that code and debugging. All those pixels and multiple resolutions. Thankfully there’s a few souls who have made the process of making games easier.

In this roundup review, we’ll cover three game source code packages that you don’t want to miss out on: a line-drawing game (think of Flight Control), a side-scrolling space shooter (like Space Tripper), and a slingshot game (like Angry Birds).

All of these game starter kits you can use to speed up your game development. When you’re just starting out learning to make games, or you are just starting out in a particular genre, it can help immensely to have all the working source code and resources in once place so you can take it apart, learn how it works and start your own game.

It’s also worth noting that while each kit has its own particular strengths and weaknesses, if you are looking to make a certain genre of game, then you probably want to overlook the pros and cons and just get that genre. It ought to be the most helpful because you have something specific in mind.

Since all the kits have their own unique outlooks, we’ve decided to cover them in random order, so even though we list one first, it doesn’t mean it’s necessarily the best. In fact, none of them are the best and none of them are the worst. They are all awesome in their own right.

Line-Drawing Game Starter Kit

by Steffen Itterheim
Language: Objective C
Content Size: ~10 MB
Contents: Reusable classes, doxygen-generated class reference, game source code, cocos2D libraries, game resources
Links: line-drawing game starter kit

Pros:

  • Clean code style
  • Well commented
  • Game plays well in simulator and device
  • Very structured and organized

Cons:

  • No iPhone retina graphics
  • Multiple non-runnable build schemes

 
This is a game starter kit that gives you a headstart with line-drawing (or path-drawing) games like Flight Control or Harbor Master. The source code is just excellent. It’s well commented, uses a clean, consistent style with plenty of margin and compiles with zero warnings. It also runs consistently well whether you are using the simulator or device.

Here’s how to get over one of the “gotchas” in this kit. If you are just starting out learning Xcode, you might wonder why you cannot run this project the first time you open it. The project has multiple non-runnable build schemes (for example, a build scheme just for box2d). While this makes your project more efficient in how it re-compiles your code, it can be a little baffling if you’re new to it all. Luckily, it’s quite easy to get it running. Just choose one of the simulators or devices from the “Line Drawing iPad” or “Line Drawing iPhone” menus in the Scheme drop-down right next to the Run button and ignore the box2d, cocos2d, and other schemes.

The way the line-drawing kit organizes the Xcode projects maximizes efficiency. There’s a separate iPhone and iPad target, so you can build two independent apps and therefore have the slimmest download size. The only drawback here is that you have multiple apps to upload, maintain, and if a customer purchases your iPad app, they don’t automatically own the iPhone version and vice versa.

If you’re looking to make a line-drawing game then this is it!

Space Game Starter Kit

by Ray Wenderlich
Language: Objective C, some Objective C++
Content Size: ~100 MB
Contents: Game source code, cocos2D libraries, game resources, 150+ page PDF tutorial, source code for previous versions
Links: space game starter kit

Pros:

  • Well-rounded starter kit
  • Comprehensive PDF tutorial
  • Concise source code
  • Plenty of art assets
  • Engaging music and sound effects

Cons:

  • Sparse comments in the source code
  • Game can only be played on the device with it held face up

 
The space game starter kit is one of the most comprehensive starter kits around thanks to it’s awesome tutorial document and well-rounded game. The tutorial teaches you how to rebuild the game from scratch, line by line, subject by subject. If you are new to iOS development, this kit might be exactly what you are looking for.

This is the only starter kit mentioned in this blog post which uses the accelerometer for movement. This is awesome if you want to learn more about the accelerometer, but note that when you run it in the simulator, there’s no way to move up or down, so you’ll end up being pummeled by asteroids until you run it on a device. If you are using this kit as a template for your own game, I recommend you first add touch controls so you can test it out in the simulator.

Digging in to the tutorial will teach you so many different things. It covers all the basics, like how to start the Xcode project and how to display the game’s title. It also goes into detail about everything else involved in the game, like how to create a parallaxing space background, how to use the accelerometer for movement, how to define physics shapes with PhysicsEditor, how to detect collisions with Box2D and a whole lot more.

If you are looking to make a side-scrolling space shooter, or you are just starting out, give this kit a go. It’s worth it!

Angry Ninjas Slingshot Game Starter Kit

by Justin Dike
Language: Objective C, some Objective C++
Content Size: ~20 MB (~430 MB including videos)
Contents: Game source code, cocos2D libraries, game resources, video tutorials
Links: slingshot game starter kit

Pros:

  • Awesome graphics
  • Engaging sound effects and ambience
  • Just like Angry Birds
  • Hours worth of video tutorials

Cons:

  • A few simulator bugs and project warnings
  • Some hard-coding and coupling

 
Justin Dike really knows how to put together awesome artwork and create a truly fun experience. If you’re an artist, you’ll probably be attracted to this kit more than the others and its easy to see why. The art and sound are awesome.

This game plays almost exactly like Angry Birds. The ninjas even have their own sound effects and stances. It’s pretty fun! The only downside is that there are few noticeable bugs when you run it in the simulator. The scrolling doesn’t follow the launched ninja, it just goes to the enemy tower. Sometimes when you launch a ninja and it completely misses, it still knocks down the tower. The physics seem a little jittery too. Those things being said, its still an awesome game kit and when you run it on the device, the glitches magically go away.

There’s a few hours worth of tutorial videos included and you can learn a ton from them, especially if you’re one of those people that learns best from a combined audio/visual format. The videos cover just about every line of code in the game and explain in detail what’s going on and how you can change the game to your liking. The only downside is that in order to understand everything fully, you cannot really skip around through the video. You basically have to watch the whole video first to get a feel for it, then later you can go back and watch certain parts to refresh your memory.

If you’re looking to make a slingshot game, then this kit has got you covered!

Batak Duel Source Code Package

by Dan Nelson
Language: Objective C, some Objective C++
Content Size: ~40 MB
Contents: Game source code, Cocos2D libraries, OpenFeint libraries, game resources
Links: Batak duel source code package

Pros:

  • Very well-commented
  • Good for beginners
  • Shows you how to use OpenFeint

Cons:

  • Long compile time
  • Not a universal app
  • Lots of global variables

 
UPDATE 4/28/2012: We got a hold of Dan Nelson’s Batak Duel source code package and thought it would be a good idea to add a little review to this roundup.

This game makes good use of transitions, sound effects, music and a scrolling text-based story to generate a good-ol’ ominous feeling. You can choose between several different characters to play as, then enter a tournament mode where you basically try to tap on certain white spots faster than the AI can. It’s your classic Whack-a-Mole style game.

One of the best things about this source code is just how well it is commented. Included in just about every source code file, there are tons of comments on the build process, links to helpful articles and other tips and tricks.

One of the gotchas in this kit is the code signing. To get the game to run on your device, you’ll need to go into the Code Signing section of your Target’s Build Settings and change all the references to “iPhone Developer: Daniel Nelson” to the “Automatic Profile Selector: iPhone Developer” setting. After changing that you can compile and deploy to your device no problem.

Want to make a Whack-a-Mole game? Batak Duel is a great place to start.

iPhone Game Kit

Well, it wouldn’t be fair if we reviewed our own iPhone game source code in this blog post. However, the reader should note that we have two game starter kits available: one that teaches you all the basics of making iPhone games with an included tutorial (the Monster Checkers game source code package) and one that is a bit more advanced, which teaches you how to make an RPG (the Quexlor RPG Engine).

Here’s a few things that other people have said about our kits:

“Quite a bit better than any other introductory level documentation we’ve seen anywhere… our wholehearted recommendation… unquestionably the best way to start out programming iOS games!”
AlexCurylo.com

“I have purchased several ‘packages’ like this and this one is clearly THE best one I have used. Honestly, it’s worth more than what you are charging for. The tilemap template is great, what a time-saver! The real benefit is that I’m finally starting to ‘get it’ with respect to Cocos2D.”
–Greg, USA

That’s all for this post. Enjoy making games!!

  • GamingHorror

    Thanks for the review, I appreciate it!
    As for the “non-runnable build schemes” I can’t remove them (they can only be hidden from view on a per-user basis) and unfortunately Xcode sorts the schemes by name. I will fix this for the next version by prefixing the app target with an underscore, so that it is listed as the first build scheme.

  • -->

    Featured Posts


    Hero Bash: the party moba!

    iOS 7 + Cocos2d 2.1 Update

    Making Cross-Platform iPhone & Android Games – Don’t Get Left Behind! (Part 3)

    Recent Posts


    Tuning the Mind

    From Programmer To Artist 10 of 10 – The Beginning

    From Programmer To Artist 9 of 10 – Animation

    The Ultimate Cocos2d-x Platformer Engine

    A cross-platform, parallaxing game engine based on cocos2dx. Includes procedural level generation, scripting, dynamic texturing, realtime multiplayer, virtual economy (in-app purchase) and all the basics like moving platforms, boxes, slopes, water, ladders and artificial intelligence. Write your game code in C++ and level scripts in Javascript. Games built with this kit can be deployed to iOS, Mac, Windows, Android and any of the other platforms supported by cocos2d-x.
    More Info...


    Action-RPG Engine Code & Tutorial

    Create your own RPG, RTS, action or adventure game with this source kit. Learn how to manage tilemaps, characters, AI and more. This kit includes a flexible RPG engine built on cocos2d iphone (now called cocos2d swift), along with a sample RPG project called Quexlor Lite. Also included is a PDF ebook tutorial and bonus royalty-free art package. Written in Objective C, games built with this kit can be deployed to iPhone, iPad and iPod Touch.
    More Info...


    iPhone Game Creation for Beginners

    This game source kit is a hands-on introduction to making games for the absolute beginner. No programming experience is required. The included PDF book walks you through all the basics of how to code with Objective C and will familiarize you with the tools you need to develop an iPhone game. It includes source code and Xcode project files to a simple checkers game built with cocos2d iphone (now cocos2d swift). Also included is documentation, a game template project, support and a bonus artwork package to start your own creation. Games built with this kit can be deployed to iPhone, iPad and iPod Touch.
    More Info...