Actually....I think the keydown stuff (checking if keys are down) took three lines...then most of it was mathematical based on what keys were down...
Hint: Use an Array
NPC Code:
if (created) {
this.cKeyDown = {0,0,0,0,0,0,0,0,0,0,0};
timeout = .05;
}
if (timeout) {
for (this.z = 0; this.z < 11; this.z++)
this.cKeyDown[this.z] = (keydown(this.z));
}
You could also have it store how long a key has been down...