Wanna Learn Cocos2d? There’s an App for that…
Cocos2d, as we’ve mentioned here before is a game development framework for iPhoneOS (it works across iPhones, iPod Touches as well as the Magical new iPad); it’s written in Objective-C and supports all the things you would need to make a robust game development system from layers, and sprites to physics engines and sound systems. Quite a few really amazing and best-selling apps have been built using cocos2d-iphone for the iPhone including Doodle Hockey, ZombieSmash and StickWars and Alice and The Elements (which is even featured the “What is iPad?” commercial) on the iPad.
If you’re just getting into iPhone game devlopment and are learning your way around Objective-C, you might be asking yourself how to start out using Cocos2d-iPhone. There are a number of tutorials on the cocos2d-iphone site which is good as a good starting point, but sometimes there’s nothing better than having some fully functional source code to be able to peruse, poke at and modify as you figure out how things work and get yourself up to speed and ready to write your own best-seller.
Of course a number of cocos2d users have made code available, but sometimes it can be best to get a comprehensive example developed by the person who created the framework, after all who would know all the ins and outs of the framework better than its creator? Fortunately, as they say, there’s an app for that…
The principal developer of Cocos2d-iPhone, Ricardo Quesada has written a demo a game for Cocos2d-iPhone called “Sapus Tongue” where you help the game’s heros (a frog or a monkey) to fly through the air to see how far they can go. The game itself exercises all of the major features of the Cocos2d framework (and by extension of the iPhone/iPad as well) from the accelerometers, menus, fonts, and touch processing, to the Chipmunk physics engine, and the sound system. The framework even supports a free-to-use a remotely hosts scoring system.
Quesada sells this example code at varying price potions (ranging ffom US$199 to US$349) which provide for varying levels of updates and email-based support (which you can use to ask questions about how/why various implementation choices for where made or why aspects of the framework work they way to do in the context of the game.).
So, why might you want to buy this code? Well, first off, if anyone can show you how to write a fully featured game in cocos2d, the principal author of the framework is probably the guy.
Secondly, the license you get with the source code purchase allows you to use the game code pretty much any way you wish including in your own games — the restrictions being very sensible ones, you can’t republish the Sapus Tongue game as though it was your own or re-use the artwork or music since they themselves are not licensed for re-use out side of the original game.
However as a learning tool and toolkit or even starting point as a skeleton for your own game it’s a great deal! It will show you a lot of great examples how how to construct a fully featured game, and probably best of all you’ll be helping to fun future enhancements to the overall framework (which will account for a lot given all sorts of wickedly cool stuff just announced at WWDC’10 in San Francisco — but which we will have to wait until the NDA expires when iOS4 [the new name of V4 of iPhoneOS] ships in a few weeks in order to freely discuss…)
If you’re looking for even more good instructional code, Ricardo also sells an app called LevelSVG which is an app you can use to create platform and side scrolling games using cocos2d; the basic premise is that you draw your game levels in a Mac SVG-capable editor called inscape. These drawings — since they’re well structured vector graphics files — can be read and interpreted by the levelSVG code and used as the basis for levels and to control various physics mechanisms in your game. Here too, purchasing a the code gets you a license to re-use bits of the levelSVG code in your own cocos2d creations.
So, the bottom line is that if you want to get up to speed on cocos2d quickly by studying and re-using some tailor made example code; this is a very cost effective way to go.