My first "real" movement template... even has onwall stuff (Which is a big step for me):
NPC Code:
// NPC made by Tgf_guy
//Basic Animal Template
if(playerenters){
this.dir = 1;
timeout = 0.05;
}
if(this.dir=0&&timeout){
x ++;
timeout = 0.19;
}
if(this.dir=1&&timeout){
y ++;
timeout = 0.19;
}
if(this.dir=2&&timeout){
x --;
timeout = 0.19;
}
if(this.dir=3&&timeout){
y --;
timeout = 0.19;
}
if(onwall(x +3,y)){
this.dir = 2;
timeout = 0.19;
}
if(onwall(x -3,y)){
this.dir = 0;
timeout = 0.19;
}
if(onwall(x,y +3)){
this.dir = 3;
timeout = 0.19;
}
if(onwall(x,y -3)){
this.dir = 1;
timeout = 0.19;
}
I know it's long. If Kyle is still there, maybe he could help me shorten it.