NPC Code:
// NPC made by Cybnext
if (this.init!=1) {
this.maxcount=30;
this.life=5;
this.arrowspeed=2;
this.arrowdamage=2;
setarray this.arrowx,this.maxcount+1;
setarray this.arrowy,this.maxcount+1;
setarray this.arrowdir,this.maxcount+1;
setarray this.arrowtime,this.maxcount+1;
setarray this.arrowact,this.maxcount+1;
this.init=1;
}
if (playertouchsme) {
toweapons PaintBall Gun;
timeout=.05;
hide;
}
if(weaponfired&&playerdarts>0){
freezeplayer .4;
playersprite=33;
playerdarts--;
setani shoot,pbgun.gif;
sleep .3;
play arrow.wav;
if(playerdir==3){
this.arrowx[this.out]=playerx+1;
this.arrowy[this.out]=playery+1.5;
}
if(playerdir==0){
this.arrowx[this.out]=playerx+1;
this.arrowy[this.out]=playery-1;
}
if(playerdir==1){
this.arrowx[this.out]=playerx-1;
this.arrowy[this.out]=playery+1.5;
}
if(playerdir==2){
this.arrowx[this.out]=playerx+1.25;
this.arrowy[this.out]=playery+2;
}
this.arrowdir[this.out]=playerdir;
this.arrowact[this.out]=0;
this.out++;
timeout=.05;
}
if(timeout){
for(e=0;e<this.out;e++){
if(this.arrowact[e]==0){
if(this.arrowdir[e]==3){
this.arrowx[e]+=this.arrowspeed;
showimg e,firemateria.gif,this.arrowx[e],this.arrowy[e];
}
if(this.arrowdir[e]==0){
this.arrowy[e]-=this.arrowspeed;
showimg e,firemateria.gif,this.arrowx[e],this.arrowy[e];
}
if(this.arrowdir[e]==1){
this.arrowx[e]-=this.arrowspeed;
showimg e,firemateria.gif,this.arrowx[e],this.arrowy[e];
}
if(this.arrowdir[e]==2){
this.arrowy[e]+=this.arrowspeed;
showimg e,firemateria.gif,this.arrowx[e],this.arrowy[e];
}
this.arrowtime[e]++;
}else{
this.arrowtime[e]=this.life*20;
}
for (c=0; c<compuscount; c++) {
if (abs(this.arrowx[e]-compus[c].x)<=2 &&
abs(this.arrowy[e]-(compus[c].y-0.5))<=2 &&
compus[c].mode!=3&&
compus[c].mode!=5){
hitcompu c,1*this.arrowdamage,this.arrowx[e]+0.5,this.arrowy[e]+0.5;
this.arrowact[e]=1;
}
}
for (d=1; d<playerscount; d++) {
if (abs((this.arrowx[e]+0.7)-(players[d].x+2))<=1 &&
abs((this.arrowy[e]+0.5)-(players[d].y+2))<=1.5){
hitplayer d,this.arrowdamage,this.arrowx[e],this.arrowy[e];
this.arrowact[e]=1;
}
}
if (this.arrowtime[e] >= (this.life*20)) {
hideimg e;
for (b=e; b<=this.out && b<20; b++) {
this.arrowx[b] = this.arrowx[b+1];
this.arrowy[b] = this.arrowy[b+1];
this.arrowdir[b] = this.arrowdir[b+1];
this.arrowact[b] = this.arrowact[b+1];
this.arrowtime[b] = this.arrowtime[b+1] - 1;
}
this.arrowx[this.out] = -1;
this.arrowy[this.out] = -1;
this.arrowdir[this.out] = -1;
this.arrowtime[this.out] = -1;
this.arrowact[this.out] = -1;
this.out--;
a--;
hideimg this.out;
}
}
timeout=.05;
}
How can i get this paintball not to fly thro objects like trees and walls, etc.