View Single Post
  #18  
Old 09-04-2007, 02:14 AM
DustyPorViva DustyPorViva is offline
Will work for food. Maybe
DustyPorViva's Avatar
Join Date: Sep 2003
Location: Maryland, USA
Posts: 9,589
DustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond reputeDustyPorViva has a reputation beyond repute
Send a message via AIM to DustyPorViva Send a message via MSN to DustyPorViva
You can define the area of a circle you're willing to check by specifying a point A with an angle and radius, then check all along a circle until getting to point B, which would also be an angle with a radius. Something like:
PHP Code:
this.width=pi/2;
this.checkcount=10;
this.checkwidth=this.width/this.checkcount;
this.radius=5;
this.angle=((player.dir-1)%4)*(pi/2);
for (
i=0;i<this.checkcount;i++) {
  
triggeraction(player.x+cos(this.angle+(this.checkwidth*i))*this.radius,player.y-sin(this.angle+(this.checkwidth*i))*this.radius,"attack");

Or something like that.
Reply With Quote