How to Make a Platformer Game with Cocos2D-X

What is Cocos2d-X?

Cocos2d-x is a game engine. It's cross-platform, open-source, free and mature.

It can be used to publish games for mobile devices and desktops, including iPhone, iPad, Android, Kindle, Windows and Mac. The good news is that only one game code base has to be written to publish to all those platforms.

Cocos2d-X is written primarily in C++ so it can compile natively on just about any system. It also includes bindings for Javascript and Lua, so game logic, scene setups and other scriptable stuff can be written in your choice of scripting language.

Who is Cocos2d-X for?

Cocos2d-X is for developers who wish to make cross-platform games.

In particular, Cocos2dx is for developers who want to use an open-source game engine. There's a thriving community of Cocos2dx developers who are helping each other succeed through online forums and sites like Stack Overflow.

The high price tag and limiting nature of closed-source engines such as Unity and Corona are what cause many a developer to choose open-source.

Another key reason to use an open-source game engine is that you can modify anything if necessary.

When was Cocos2d-X written?

The Cocos2d-X project was started around July 4th, 2010. Primary contributors to the project have been Walzer Wang, Minggo Zhang and James Chen. Many other contributors have authored the project as well.

Where did Cocos2d-X come from?

Cocos2d-X came from Cocos2d iPhone, the popular, iOS & Mac game engine written in Objective C.

Since Cocos2dX is a nearly exact port of Cocos2d iPhone written in C++, it maintains the same API. So if you are comfortable with Cocos2d iPhone (commonly referred to as just "Cocos2d") and you know some C++, then you will be right at home with Cocos2dX.

Why use Cocos2d-X?

The feeling of compiling your game for multiple platforms with the same codebase is simply electric. Here's an article about why Cocos2d-X is one of the best game engines.

How to use Cocos2d-X?

Learning Cocos2d-X can take a bit of time. Thankfully there are plenty of resources.

The Paralaxer project is a complete Cocos2d-X example platformer game, including project files for iOS, Android, Windows and Mac. There's also a free Cocos2d-X book being written one chapter per week.

Here's a basic Cocos2d-X tutorial to get you started.

Got questions? Leave a comment below. You can also subscribe to be notified when we release new chapters.