View Single Post
  #4  
Old 01-18-2002, 07:50 PM
TDO2000 TDO2000 is offline
Registered User
TDO2000's Avatar
Join Date: Jul 2001
Location: Germany
Posts: 655
TDO2000 is on a distinguished road
u need to do showimg and hitplayer/hitobjects or just a triggeraction to attack (I had the best results with triggeraction)

something like:
NPC Code:

if(weaponfired && this.active==0){
this.xy={playerx,playery};
this.dir=playerdir;
this.distance=0;
this.maxdis=15;
this.active=1;
timeout=.05;
}

if(timeout){
if(this.distance < this.maxdis){
this.distance++;
this.xy[0]+=vecx(this.dir);
this.xy[1]+=vecy(this.dir);
showimg 1,yourprojectile.gif,this.xy[0],this.xy[1];
hitobjects 1,this.xy[0],this.xy[1];
}
else {this.active=0;}
if(this.active==1){timeout=.05;}
}



could be shorter but this should show u how to do it...
__________________
No Webhost at the moment