- Edited
Hey everybody, quick question:
I am developing an RTS game and the time has come to implement units' "attack" order, which means I need to check which unit was clicked.
Beforehand, I used unhandled_input queue for handling movement commands.
To select units, I am currently iterating over all the selectable units and looking for the one with closest distance from the click -> this will underperform when attacking, as there are several times more units that are "attackable" than "selectable".
I noticed that there is an "input_event" signal for the bodies which seems to be what I am looking for, but unfortunately the events are handled by the unhandled_input function first (responsible unit selection and movement commands).
Any ideas how to do it better than iterating through all attackable units?
Thanks for responses
Maks