Game on - Cocos2D-js

This is my second post in the "Game on" series about creating a game with various game engines.
You may want to read the first post which was about GameClosure.

This time I will focus on Cocos2D-js.

Tested version: 2.2.3

This is the first framework I found that works with the cartezian coordinates system. The (0, 0) point is not in the top left corner as we're used from all graphic programs and web but in the bottom left corner. This feels a bit awkward at first but nothing you cannot overcome. Also, the default anchor point is in the middle of a sprite, not in the top left but you can change that.

The biggest problem I faced was the lack of documentation. The little documentation and examples I found were too old (compared to how fast the framework advances) and they were pretty much useless because of this. API documentation is pretty much inexistent. You want to see what some method does? You might be lucky to find the parameters of the function listed but nothing else. No usage example, no description of the function, nothing. And this when you do find the function in the api docs because you probably won't.
cc.Layer is one of the 3 building blocks in Cocos2D-js and it doesn't even have an API doc.
To add to this, the docummentation and the couple of tutorials on their site are not written by someone who speaks english natively. It's not unreadable but pretty annoying.

The best example game I found on the Tizen site, along with a much better project structure than the default example. It was good but, unfortunately, not enough to create a different game.

I know there are quite a lot of AAA games created with Cocos2D and maybe the documentation for the c++ version is stellar. But for someone who just wants to do things in js, things are a big, big mess.
Give me official and up to date examples for more than 1 (type of) game, give me docummentation and usage examples for each and every function/method/class/constant/variable and then I will start using Cocos2D-js. Until then, goodbye.

A few more things that I noted down while trying to learn the framework - not show stoppers like the lack of proper docummentation but still hard to swallow in 2014:

  • the constructor method of a class is called ctor(). Really?
  • there is a lot of unneeded startup boilerplate. You first load a file which loads the preloader, then another file loads and from this file you load the main app. It is very configurable, I give it that, but most of the time you just copy the same files over and over again, from project to project. Just give me some defaults which I can change if I really want to. I like how Phaser starts up: var game = new Phaser.Game(800, 600, Phaser.AUTO).
  • some strange names for methods like applicationDidFinishLaunching() or didFinishLaunchingWithOptions(). What's wrong with the classic onAfterLaunch() or something?


I wish I could've done more with Cocos2D-js. I really wanted to like it as Cocos2D seemed mature and fast on both mobile and web. I managed to load and show the first level of the game without any kind of user interaction but some tiles were shown smaller than others, although they all had the same size in the spritesheet and they were resized to the same value in code.
Maybe I could've solve the problem but I felt that every step so far was a struggle - it just wasn't fun anymore.

Version 3.0 is coming soon and I hope they will focus on better docs after that. Until then, Cocos2D-js is not for a JS dev.