I'm crash coursing cocos2d-javascript with an extremely tight deadline and am finding very few javascript specific examples to draw from.
Currently I'm drawing sprites, moving them, then removing them using the common method:
var enemy = cc.Sprite.create(s_spritesheet, cc.rect(0, 0, 128, 149));
// other setters here
this.addChild(enemy);
var move = cc.MoveTo.create(3, cc.p(-300, 200));
var done = cc.CallFunc.create(function(node) {
//remove from enemy array, which never has more than 10 items
cc.ArrayRemoveObject(this.enemies, node);
node.removeFromParent();
}, this);
enemy.runAction(cc.Sequence.create(move, done));
Works fine and the game runs as expected except that it has some noticeable lag at times and choppy movement in some browsers. So while researching ways to improve performance I see mention of texture atlas improving performance but no solid examples. Everything I find is related to iOS, which is syntactically different enough to be confusing given the short time frame I have to work with. I've looked over the docs, but without an example I'm guessing more than anything and SO could use a few more cocos2d-javascript examples.
So does anyone have a javascript example of how one would use a texture atlas for multiple objects using the same spritesheet? Or an explanation on why just using Sprite.create this way may not be the culprit for the lag and chop?