I just stumbled on this library/language called Coffescript, and thought it would do the coding part so much easier.
As an example, drawing maps with a for
loop would be:
map = [0, 0, 0, 0, 0]
drawTile = (tile, tx = tile * ts, ty = 0) -> c.drawImage(tile, tx, ty)
drawTile tile for tile, i in map
Translates to this:
var drawTile, i, tile, _i, _len;
drawTile = function(tile, tx, ty) {
if (tx == null) {
tx = tile * ts;
}
if (ty == null) {
ty = 0;
}
return c.drawImage(tile, tx, ty);
};
for (i = _i = 0, _len = map.length; _i < _len; i = ++_i) {
tile = map[i];
drawTile(tile);
}
I've only had an hour to look at this, but sofar I think its beautiful. My question is how would this fit into HTML5 game development? Could there be any problems using this that I don't see?
I know the code above is useless in a real game, but I haven't figured out loops yet.