Game Engines
Free
2D
- https://github.com/batiste/sprite.js - sprite animation framework
- http://renderengine.com/
- http://gamequery.onaluf.org/ - designed to be used with jQuery
-
- tile based
'use strict'; | |
let assert = (condition) => { | |
if (!condition) throw new Error('assertion error') | |
} | |
let sum = (_,a,b) => a+b | |
let mul = (_,a,b) => a*b | |
let sub = (_,a,b) => a-b | |
let div = (_,a,b) => a/b |
application:open-your-keymap | |
application:open-your-stylesheet | |
autocomplete:attach | |
autoflow:reflow-paragraph | |
bookmarks:clear-bookmarks | |
bookmarks:jump-to-next-bookmark | |
bookmarks:jump-to-previous-bookmark | |
bookmarks:toggle-bookmark | |
bookmarks:view-all | |
check:correct-misspelling |
function rgbToHex(r, g, b) { | |
var ret; | |
return [ r, g, b ].map( function(val) { | |
ret = val.toString(16); | |
return ret.length == 1 ? "0" + ret : ret; | |
}).join(""); | |
} |
//FightCode can only understand your robot | |
//if its class is called Robot | |
var Robot = function(robot) { | |
}; | |
Robot.prototype.onIdle = function(ev) { | |
var robot = ev.robot; | |
robot.ahead(100); |
function resolveCollisions() { | |
var collision = world.m_contactList; | |
if (!collision) return; | |
var obj1 = collision.GetShape1(); | |
var obj2 = collision.GetShape2(); | |
if ( (obj1.m_body.m_shapeList.renderType == "player" && obj2.m_body.m_shapeList.renderType == "exit") || |
// this code sux. | |
(function() { | |
function getKeys(object) { | |
var keys = []; | |
for (var key in object) { | |
if (!key.match(/^_Firebug/)) { | |
keys.push(key); | |
} | |
} |
pilkowski@dev:~$ npm ls | grep yui3 | |
└─┬ yui3@0.6.2 | |
└── yui3-core@3.3.0 | |
pilkowski@dev:~$ node -v | |
v0.4.8 | |
pilkowski@dev:~$ npm -v | |
1.0.13 | |
pilkowski@dev:~$ node | |
> var y = require('yui3') | |
> !!y |
var sth1 = {}, sth2 = {}; | |
sth1.x = 10; // x pos | |
sth1.y = 10; // y pos | |
sth1.r = 10; // radius | |
sth2.x = 15; // x pos | |
sth2.y = 15; // y pos | |
sth2.r = 10; // radius |
var MyClass; | |
(function() { | |
MyClass = function() { | |
this.val = 2; | |
} | |
MyClass.prototype.publicFunction = function() { | |
return privateFunction.call(this); | |
} | |
privateFunction = function() { | |
return this.val + " is the value of val"; |