Thread: Gravity
View Single Post
  #15  
Old 06-06-2005, 11:12 PM
Maxalou2k Maxalou2k is offline
Registered User
Join Date: Aug 2004
Posts: 12
Maxalou2k is on a distinguished road
Try this...
PHP Code:
// NPC made by someone... I hope
if (playerenters) {
hide;
toweapons *Gravity;
playerx=int(playerx);
playery=int(playery);
playerdir=3;
timeout=0.05;
}
if (
timeout&&isweapon) {
if (!
antigravity) {
if (
keydown(0)&&playersprite>=1&&playersprite<=8playery+=0.5;
if (
playerdir==0||playerdir==2playerdir=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<=8playery-=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<=0velocity=0.1;
if (
velocity>3velocity=3;
}
if (
abs(velocity)>0) {
playery+=velocity/6;
if ((
velocity>0&&(onwall(playerx+0.5,playery+3)||onwall(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)||onwall(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)||onwall(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)||onwall(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)||onwall(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==1this.sx-=0.75;
if (
this.sd==3this.sx+=0.75;
showimg 345,busterl2d#v(this.sd).gif,this.sx,this.sy;
if (this.sd==1) {
if (
testplayer(this.sx,this.sy)>-2hitplayer testplayer(this.sx,this.sy),2,playerx,playery;
if (
testnpc(this.sx,this.sy)>-2hitnpc testnpc(this.sx,this.sy),2,playerx,playery;
if (
testcompu(this.sx,this.sy)>-2hitcompu testcompu(this.sx,this.sy),2,playerx,playery;
}
if (
this.sd==3) {
if (
testplayer(this.sx+1,this.sy)>-2hitplayer testplayer(this.sx+1,this.sy),2,playerx,playery;
if (
testnpc(this.sx+1,this.sy)>-2hitnpc testnpc(this.sx+1,this.sy),2,playerx,playery;
if (
testcompu(this.sx+1,this.sy)>-2hitcompu 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,busterl2d#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;
}
if (
created) {
if (
keydown(6)) {setani jumpnrun,;}

Reply With Quote