My method draws a line from Player to Mouse.
If the Line is overlapping and Obstacle, 2 fastLoops are triggered in this order:
FAST LOOP A
- Halves the length of the line untill Line is no longer overlapping Backdrop ( also stores the length halved )
- If Line is no longer overlapping Backdrop, the Line is increased by 1/10 of the last line halving
- As the line is increased and overlapps a backdroop, the line is reduced by 1/10 of the last line halving, and the loop ends
FAST LOOP B
- This loop simply increases the Line length by 1 untill it hits an Obstacle, in wich case the Line is reduced by 1 and the loop ends
...
The idea behind this is to get as close to the Obstacles as possible by using big steps before starting to fine tune by moving 1 pixel at a time.
Ill uppload a new example wich has a counter displayong exactly how many loop ( accounting for both loops ) iterations are run for each execution.
If you stay inside the Frame the number of loops run is about 2 - 20 for each execution, but if you start moving outside the frame however the number of iterations increase.

