call me Chad, it's cooler
|
|
Join Date: Aug 2002
Posts: 1,899
|
|
Hmm, now that you mention it, it does look similar to this script (which I edited awhile ago and don't remember what I did)
NPC Code:
// NPC made by DarkNija
if (playerenters) {
hide;
toweapons Gravity;
playerx=int(playerx);
playery=int(playery);
playerdir=3;
timeout=0.05;
}
if (timeout&&isweapon) {
if (playerhearts==0) {
players[0].dir=2;
}
if (!antigravity) {setgif gravityboots2.png;replaceani swim,marioswim;
if (playerswimming&&keydown(0)) {velocity=-1;}
if (keydown(0)&&playersprite>=1&&playersprite<=8) {playery+=.05;}
if (playerdir==0||playerdir==2) {playerdir=gravdir;}
if (onwall(playerx+0.5,playery+3)||onwall(playerx+1.5 ,playery+3)) {
velocity=0;
playery=int(playery);
if (keydown(6)) velocity=-2;
}
else if (keydown(2)&&playersprite>=1&&playersprite<=8) playery-=0.5;
if (onwall(playerx+0.5,playery-0.1)||onwall(playerx+0.5,playery)||onwall(playerx+ 1.5,playery)||onwall(playerx+1.5,playery-0.1)) velocity=0.1;
else {
if (velocity>-0.1&&velocity<=0) velocity=0.1;
if (velocity>3) velocity=3;
}
if (abs(velocity)>0) {
playery+=velocity/6;
if ((velocity>0&&(onwall(playerx+0.5,playery+3)||onwa ll(playerx+1.5,playery+3)))||(velocity<0&&(onwall( playerx+0.5,playery)||onwall(playerx+1.5,playery)) )) playery=int(playery);
else playery+=velocity/6;
if ((velocity>0&&(onwall(playerx+0.5,playery+3)||onwa ll(playerx+1.5,playery+3)))||(velocity<0&&(onwall( playerx+0.5,playery)||onwall(playerx+1.5,playery)) )) playery=int(playery);
else playery+=velocity/6;
if ((velocity>0&&(onwall(playerx+0.5,playery+3)||onwa ll(playerx+1.5,playery+3)))||(velocity<0&&(onwall( playerx+0.5,playery)||onwall(playerx+1.5,playery)) )) playery=int(playery);
else playery+=velocity/6;
if ((velocity>0&&(onwall(playerx+0.5,playery+3)||onwa ll(playerx+1.5,playery+3)))||(velocity<0&&(onwall( playerx+0.5,playery)||onwall(playerx+1.5,playery)) )) playery=int(playery);
else playery+=velocity/6;
if ((velocity>0&&(onwall(playerx+0.5,playery+3)||onwa ll(playerx+1.5,playery+3)))||(velocity<0&&(onwall( playerx+0.5,playery)||onwall(playerx+1.5,playery)) )) playery=int(playery);
else playery+=velocity/6;
}
velocity+=abs(velocity/4);
if (this.shot==9) {
hideimg 345;
this.shot=0;
}
if (this.shot>0) {
if (this.sd==1) this.sx-=0.75;
if (this.sd==3) this.sx+=0.75;
showimg 345,throwsword#v(this.sd).gif,this.sx,this.sy;
if (this.sd==1) {
if (testplayer(this.sx,this.sy)>-2) hitplayer testplayer(this.sx,this.sy),2,playerx,playery;
if (testnpc(this.sx,this.sy)>-2) hitnpc testnpc(this.sx,this.sy),2,playerx,playery;
if (testcompu(this.sx,this.sy)>-2) hitcompu testcompu(this.sx,this.sy),2,playerx,playery;
}
if (this.sd==3) {
if (testplayer(this.sx+1,this.sy)>-2) hitplayer testplayer(this.sx+1,this.sy),2,playerx,playery;
if (testnpc(this.sx+1,this.sy)>-2) hitnpc testnpc(this.sx+1,this.sy),2,playerx,playery;
if (testcompu(this.sx+1,this.sy)>-2) hitcompu testcompu(this.sx+1,this.sy),2,playerx,playery;
}
this.shot++;
}
if (playersprite==11&&playerhearts==playerfullhearts) {
this.shot=1;
this.sd=playerdir;
if (this.sd==1) {
this.sx=playerx-2;
this.sy=playery+1;
}
if (this.sd==3) {
this.sx=playerx+2;
this.sy=playery+1;
}
showimg 345,throwsword#v(this.sd).gif,this.sx,this.sy;
}
if ((keydown(0)||keydown(2))&&!(keydown(1)||keydown(3 ))) playersprite=0;
if (keydown(1)&&!keydown(3)) playerdir=1;
if (keydown(3)&&!keydown(1)) playerdir=3;
gravdir=playerdir;
}
timeout=0.05;
}else{setgif gravityboots.png;replaceani swim,swim}
if (keydown(6)) {setani jumpnrun,;}
|
|