### trigonometry

#### How can I calculate the angle

```I'm creating a game where if the enemy is in a certain range and is in front of the player the player can attack the enemy. I have worked out the radius distance and made it facing forward depending in which way the player faces but how can i create the angle so it makes like a cone shape from the player. I have got an image. The thin green line is the radius which I have worked out but how can i calculate the red cone.
Here is the image for more better understanding
http://tinypic.com/view.php?pic=28v63h0&s=6
This is what I done so far
package
{
import flash.display.MovieClip;
import flash.events.Event;
import flash.events.KeyboardEvent;
import flash.events.MouseEvent;
import flash.ui.Keyboard;
public class Player extends MovieClip
{
public function Player()
{
}
function Update(event:Event)
{
// Rotate to mouse;
var dx = parent.mouseX - x;
var dy = parent.mouseY - y;
var angle = Math.atan2(dy,dx) / Math.PI * 180;
rotation = angle;
}
}
}
```
```You can use the definition of tangent:
tan(a/2) = s/(2d)
where s is size (diamerer) of the enemy and d is the shortest distance to the enemy. Here a is the total visible angle (between two red lines).```

### Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization