Skip to content

Instantly share code, notes, and snippets.

@necoco
Created April 15, 2014 13:05
Show Gist options
  • Save necoco/10730971 to your computer and use it in GitHub Desktop.
Save necoco/10730971 to your computer and use it in GitHub Desktop.
test
rune();
var update = rune.update();
var player = {x: 0, y: 0, width: 20, height: 20, dir: 1};
function move(p){
p.x += 100 * this.deltaTime * p.dir;
return p;
}
function leftDir(p){
p.dir = -1;
}
function rightDir(p){
p.dir = 1;
}
update(rune.clear);
update(player)(move)(rune.fillRect);
rune.watch(player, "x", rune.ge(200))(leftDir);
rune.watch(player, "x", rune.le(0))(rightDir);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment