terça-feira, 8 de abril de 2008

Super Mario em um Javascript de 14kb.

http://blog.nihilogic.dk/2008/04/super-mario-in-14kb-javascript.html

http://www.nihilogic.dk/labs/mario/mario.js


/*
* The Javascript Mario Experiment v0.1
* Copyright (c) 2008 Jacob Seidelin, cupboy@gmail.com
* MIT License [http://www.opensource.org/licenses/mit-license.php]
*/


var Mario = function(bMusic, iScale) {

// our own variables can be compressed, builtin functions can't
var toInt = parseInt,
setTimer = setTimeout,
getElement = function(id){return document.getElementById(id);},
appChild = function(parent, child) {return parent.appendChild(child);},
dc = function(tag) {return document.createElement(tag);},
child = function(e,i){return e.childNodes[i]},
charAt = function(str,idx) {return str.charAt(idx);},
floor = Math.floor, round = Math.round;

// -----------------------------------------------------------------
// begin game setup
// -----------------------------------------------------------------


var bHasCanvas = !!(dc("canvas").getContext);

Nenhum comentário:

Minha lista de blogs