/*===========================================
NPC by Aylad
===========================================*/

if (created) {
setimg roast.gif;
drawunderplayer;
y-=.3;
this.add=.6;
this.mode=0;
}
if (playerdir=0){
this.offx=.75;
this.offy=(0-2);
}
if (playerdir=1){
this.offx=(0-2);
this.offy=1;
}
if (playerdir=2){
this.offx=.75;
this.offy=3;
}
if (playerdir=3){
this.offx=2.5;
this.offy=.75;
}
if (playertouchsme) {
freezeplayer .1;
setstring hunger,#v(strtofloat(#s(hunger))+1.5);
setplayerprop #c,+1.5 food points;
play eat.wav;
destroy;
}
if(timeout){
if (x>playerx+this.offx){
x-=this.add;
}
if (x<playerx+this.offx){
x+=this.add;
}
if (y>playery+this.offy){
y-=this.add;
}
if (y<playery+this.offy){
y+=this.add;
}
}
if(abs(x-playerx+this.offx)<.3&&abs(y-playery+this.offy)<.3&&this.mode=0){
this.mode=1;
x=playerx+this.offx;
y=playery+this.offy;
} else {
//sleep .01;
timeout = .05;
}