Thread: move
View Single Post
  #4  
Old 01-07-2004, 11:54 PM
Python523 Python523 is offline
Banned
Join Date: Aug 2001
Location: Illinois
Posts: 3,498
Python523 is on a distinguished road
NPC Code:

if (created){
message Ask me to "Come Here".;
}

if (playerchats){
if (strequals(#c,Come Here)){
move();
message Coming sir.;
}
}

function move(){
this.dx = playerx-x;
this.dy = playery-y;
this.dis = (this.dx^2 + this.dy^2)^0.5;
this.angle = getangle(this.dx,this.dy);
i = 0;
gox = x;
goy = y;
while (i<this.dis){
newx = gox + cos(this.angle);
newy = goy - sin(this.angle);
if (onwall(newx+1.5,newy+2) || onwater(newx+1.5,newy+2))
break;
gox = newx;
goy = newy;
i++;
}
if (i > 0) {
setcharani walk,;
move gox-x,goy-y,2,1+4+8+16;
}
}

if (movementfinished){
message Here.;
setcharani idle,;
}

Reply With Quote