prozac424242

08-02-2001, 08:46 AM

I want to make a shooting wepaon that

instead of

if (playerdir==0){y--;}

if (playerdir==2){y++;}

it is jsut one command thing.

here is what i got so far

except it goes diagonal.

How far off am i?

// NPC made by Prozac

if (playerenters) {show;}

if (playertouchsme) {toweapons throw thing;}

if (weaponfired)

{

this.distance=10; //how far to throw

setarray this.newx,4;

this.newx[0]=playerx; this.newx[1]=playerx-1;

this.newx[2]=playerx; this.newx[3]=playerx2;

setarray this.newy,4;

this.newy[0]=playery-2; this.newy[1]=playery+1;

this.newy[2]=playery+4; this.newy[3]=playery+1;

setplayerprop #c,#v(this.newx[playerdir]);

for (this.i=0; this.i<this.distance; this.i++)

{

putexplosion 0,this.newx[playerdir]+this.i,this.newy[playerdir]+this.i;

sleep .1;

}

}

instead of

if (playerdir==0){y--;}

if (playerdir==2){y++;}

it is jsut one command thing.

here is what i got so far

except it goes diagonal.

How far off am i?

// NPC made by Prozac

if (playerenters) {show;}

if (playertouchsme) {toweapons throw thing;}

if (weaponfired)

{

this.distance=10; //how far to throw

setarray this.newx,4;

this.newx[0]=playerx; this.newx[1]=playerx-1;

this.newx[2]=playerx; this.newx[3]=playerx2;

setarray this.newy,4;

this.newy[0]=playery-2; this.newy[1]=playery+1;

this.newy[2]=playery+4; this.newy[3]=playery+1;

setplayerprop #c,#v(this.newx[playerdir]);

for (this.i=0; this.i<this.distance; this.i++)

{

putexplosion 0,this.newx[playerdir]+this.i,this.newy[playerdir]+this.i;

sleep .1;

}

}