In my 2D game I would like to have indicators (arrows) pointing to enemy ships which are offscreen.
So far I have defined:
- If a ship is offscreen (not in the camera rectangle)
- The rotation the arrow should be pointing in (towards enemy ship)
That is all fine. My problem is that I want the arrows to be placed around the edge of my screen - the closest point to an enemy ship without going offscreen.
I would be grateful if the community could point out how this can be done. I'll be happy to post code if required, but to be honest it's just rotation and distance calculations so far. Links to articles would also be great.
Many thanks for your assistance.