Hi. We wrote a little game with Cocos2D-X,

And released the source code!

Paralaxer is a cross-platform platformer game and game starter kit, running on iOS, Android, Windows, & Mac using the same C++ game code. This site is also home to a "living" Cocos2d-X book.

Play the Paralaxer video introduction

Elegance.

Paralaxer looks crisp no matter what screen you play it on. That's because it uses three tiers of art assets.

If you're running an old iPhone or Android device, it uses SD images. If you've got an iPhone with Retina or a Kindle Fire, it uses the HD images. Got a retina iPad or MacBook Pro? Paralaxer cracks out the double-mega-huge images.

With Paralaxer's source code, you'll learn how to make a game that handles multiple platforms and resolutions with ease.

So what are you waiting for?

Download Paralaxer's game source code.

How to Make a Cross-Platform Platformer With Cocos2D-X

The free Cocos2D-X book.

This website is home to an online book about how to make Paralaxer from scratch. It's called "How to Make a Platformer Game With Cocos2D-X".

This is a living book. It gets updated as Cocos2d-X does. It covers everything from creating a meta-project to artificial intelligence. There's even a chapter about how to publish games yourself and become a wealthy apprepreneur.

The downloadable Paralaxer starter kit includes a PDF version of the online book. It's exactly the same content as you see online, except it's all packaged into one neat book you can flip through at your leisure.


 

What's so great about Cocos2d-x?

  • It's free! Save your hard-earned cash. Cocos2D-X is 100% free and you never have to pay any royalties.
  • It's open-source. Need to change one little thing in the game engine? Go ahead.
  • It's wicked fast. With Cocos2D-X, it's easy to get 60 FPS, even on older devices or full-screen on Mac or Windows.
  • Develop on Mac, Windows or Linux! Write code in your most comfortable IDE, whether that's Xcode, Visual Studio, Eclipse or Emacs.
  • Deploy to Android, iOS (requires a Mac), Windows, Mac, Linux, Windows Phone and many more platfoms, all with the same code base.
  • Well-known API. It uses the same API as Cocos2D-iPhone. So if you're familiar with CCDirector, you'll be right at home with the Cocos2D-X.
  • Lua & Javascript support. Cocos2D-X has built-in support for the Lua and Javascript languages. When it comes to writing your game's logic, you've got plenty of options. Not only that, but if you write your entire game in Javscript, you can easily port it to the web using Cocos2d-HTML5.
  • The Cocos2D / Cocos2D-X / Cocos2D-HTML5 paradigm is mature. Once you get the hang of it, you'll be able to code at ludicrous speed.
  • Thousands of published games and growing every day.
  • It's MIT Licensed. The MIT license is one of the most flexible and open-source-friendly licenses out there.
  • Handles OpenGL for you. If your allergic to GLuints, fret not! You'll never have to learn OpenGL. Unless you want to, of course. In that case, you can override any node's draw function and glBlendFunc away. Cocos2d-X uses OpenGLES 2.x on mobile devices and OpenGL 2.x for desktops, so you've got the power of shaders at your disposal.
  • The Action API is really handy. Everything in Cocos2D-X is a node and every node can run multiple actions. Want to scale a sprite, rotate it, fade it out and then invoke a callback function? It takes only a few lines of code.
  • Supported by a thriving community. This is one of those golden nuggets that makes coding with Cocos2D-X such a pleasure. The community is there to help you.
  • Has physics, sound & a tilemap parser. Comes with Box2D and Chipmunk for physics, CocosDenshion's SimpleAudioEngine for cross-platform sound, and even a TMX tile map parser so you can make levels with the open-source Tiled editor.
 

Why code with C++?

  • Most portable language. This is a big reason to go with C++. It's simply the most portable language around. Whether you are compiling for Mac, Windows, Linux, iOS or Android, they all support C++ natively. Objective C is such a beautiful language and so is C#, but the fact is that these languages aren't supported natively on all platforms.
  • Fastest language. Google recently did a study and found that C++ is the best-performing language around. When you want to write games, you need that speed.
  • Most common-place language in game-development. If you've been a game programmer for awhile, you already know all about C++. In the game dev world, C++ is ubiquitous, omnipresent and -- if you believe in quantum entanglement -- perhaps even omniscient.
  • It's a stick-shift. C++ is a car with a manual transmission. Sure, it's not as easy to drive as an automatic, but it gives you a whole new level of control. If you're one of those people that prefers to clutch into neutral when hitting a patch of gravel, C++ is going to be a love affair.
  • Recently improved C++11. C++ just got a make over called C++11. There's a few bits of syntactic sugar that will make your programming life easier. The auto keyword, for example, is simply awesome. The great news is that we've written Paralaxer in C++11 and found out all the things that you can and cannot do with a cross-platform game code base. In addition, Cocos2d-X has recently been refactored into entirely C++11 code as of version 3.0.
 

A look at Paralaxer's source code.

Paralaxer uses Box2D for physics, TMX tiled maps for levels, the Tiled map editor for level editing and the KITProfile class for automatic resource loading (available only in the Paralaxer code base). An AI subclass is provided to show you the basics of how to implement different and unique enemies and NPCs.

Paralaxer's source code is clean, well-commented and Doxygen-ready. Here's a look at Player.h and Player.cpp.

Ready to download all the code? Excellent.

Brought to you by the iPhone Game Kit.