try this, i just made it up right now, so mite be wrong in some places =D
NPC Code:
// NPC made by Lord Helmut
//255x144 width=63 height=48
if(created){
this.hearts=5;
this.speed=.5;
this.x=x;
this.y=y;
setimgpart #f,0,0,63,48;
}
if(playerenters){
timeout=.05;
}
if(timeout){
i=int(random(0,4));
for(a=0;a!=3;a++) {
setgifpart b_piranah.png,63*i,48*1,63,48;
sleep .3;
setgifpart b_piranah.png,63*i,48*0,63,48;
sleep .3;
setgifpart b_piranah.png,63*i,48*2,63,48;
sleep .3;
}
timeout=3;
}