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.