NPC Code:
// NPC made by Lord Helmut
// Shortened by Kyle0654
// 255x144 width=63 height=48
if (created) {
this.dirgo = {0,2,1,3};
this.hearts = 5;
this.speed = .5;
this.x = x;
this.y = y;
setimgpart #f,0,0,63,48;
}
if (playerenters||timeout) {
i = int(random(0,3.9));
swim();
timeout = 3;
}
function swim() {
for (this.z = 0; this.z < 9; this.z++) {
setimgpart b_piranah.png,63*(this.dirgo[i]),48*((10-this.z)%3),63,48;
sleep .3;
}
}
You'll of course need some code for actually moving it...and I'd suggest rearranging your sprite set to eliminate the need for the
dirgo modifier.