I just slipped throught it, but here some small tips:
Instead of:
if(blabla == 0) you can use if (!blabla)
Oh and also, instead of:
PHP Code:
if (keydown(1)) {
this.dir = 1;
}
if (keydown(2)) {
this.dir = 2;
}
if (keydown(3)) {
this.dir = 3;
}
if (keydown(0)) {
this.dir = 4;
}
you can use:
PHP Code:
for (i=0; i<4; i++) {
if (keydown(i)) {
this.dir = i;
}
}