We want your feedback

We want your feedback
0.0 0


Hi guys

After the alpha version of Cocos2d-html5 is launched, we have received many feedback. It quickly came to our attention that we need to “prettify” our API :),

We had a video chat with Ricardo Quesada and Rolando Abarca discussed these cases, the conclusion is that we had a list to choice, and need your feedback to see what is preferred by most developers.

We need to decide these following:


  1. cc
    * sample: var monster = new cc.Sprite;
    * pros: short, easy to type, maybe good for performance
    * cons: What’s cc stands for? conflict with existing popular js framework?

  2. CC (capital letters)
    * same as above

  3. cocos2d
    * sample: var monster = new cocos2d.Sprite;
    * pros: full meaning
    * cons: very long to type

  4. cocos
    * sample: var monster = new cocos.Sprite;
    * pros: the in betweener of cc and cocos2d
    * cons: the same to pros

Property access

  1. monster.position.x = 100; var pos = monster.position;
    * pros: easy to use, very readable
    * cons: The setter is harder to rewrite, cannot chain methods like jQuery
    * Ref:https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/defineProperty

  2. monster.position(100,200); var pos = monster.position();
    * pros: jQuery Style, use same function for both set and get
    * cons: might affect performance, because it have to check if there is any parameters passed in

  3. monster.setPosition(100,200); var pos = monster.getPosition();
    * pros: Explicit use of set and get, easy to rewrite
    * cons: more characters to type

Object Constructor

Note: chained setter functions will be decided in question 2

  1. var a = new Sprite(); a.setFile(…).setPosition(…); OR var a = (new Sprite()).setFile(…).setPosition(…);
    * pros: classic object creation, chaining is possible when you put new in bracket
    * cons: 2 lines of code if not chained, very ugly chain, fails if you forget bracket with new

  2. var a = Sprite().setFile(…).setPosition(…);
    * pros: easy chaining, 1 line, nice to the eye
    * cons: no “new” keyword, you could not tell this line creates an object

  3. var a = Sprite.spriteWithFile(…).setPosition(…);
    * pros: easy chain, same as Cocos2d-x
    * cons: no “new” keyword, looks C++ ish

please participate this online survey here:

{{iframe(http://www.surveymonkey.com/s/NQJC7BN, 650, 750)}}

Thank you!




I’m wondering if there’s a “perspective method” on a sprite. If not, I suggest to add it. I’m talking about something like this:

(I also suggest to get ideas for manipulation methods on a sprite looking at the GIMP tools!)


Is this sticky now out of date and does it need to be removed?

As far as I was aware the decisions on this have now been taken an implemented.

If so perhaps this sticky should be removed.