Actually feral already made this kind of demo here:
viewtopic.php?f=4&t=5995
But the problem is, he uses Bubble Sort which may be better suited for advanced coder. But then, what about for newbie who's still very new to coding and stuff?
Here, I made this demo specially for you guys. Also, as complement to feral's demo.
Explanation
===========
Basically, the method goes this way:
- Player keep producing scanner toward the group of enemies
- Enemy who touches the scanner first will set the target coordinates
- When the Player shoots, bullet will be directed to the target coordinates
As simple as that.
For the detailed code, please take a look at the demo attached bellow.