try this simple one...
NPC Code:
// sliding door by Ice Pick
if (playerenters && players[0].x == 9 && players[0].y == 25){
timereverywhere;
setgifpart ninjidoorleft.gif, 0, 33, 32, 32;
this.mode = 2;
this.open = 33;
timeout = 0.5;
this.start = 0;
}
else if (playerenters) {
setgif ninjidoorleft.gif;
timereverywhere;
this.open = 0;
this.mode = 0;
this.start = 1;
}
if (playertouchsme && (((this.mode == 1 || this.mode == 0) && this.open == 0) || (this.mode == 2 && this.wideopen != 1))) {
this.mode = 1;
play fire.wav;
timeout = 0.1;
this.start = 0;
}
if (timeout && this.start == 1) this.start = 0;
else if (timeout) {
if (this.mode == 1) this.open+=6;
if (this.mode == 2) {
this.open-=2;
this.wideopen = 0;
}
setgifpart ninjidoorleft.gif, 0, this.open, 32, 32;
blockagain;
if ((this.mode == 1 && this.open <= 32) || (this.mode == 2 && this.open >= 0)) timeout = 0.1;
else if (this.mode == 1){
dontblock;
timeout = 2;
this.mode = 2;
this.wideopen = 1;
}
else play arrowon.wav;
}