Godot Version
4.7.2.stable
Question
Hi, I am trying to create a strategy game and in doing so, I need to select a unit through clicking the unit with left mouse button and then doing the same on the map, to get the unit to move to the position that was clicked on the map.
I have been able to get this working occasionally, but I run into 2 problems and I haven’t been able to figure out a solution for it.
- The input_event is triggering randomly. What I mean by this is the input_event is only triggering occasionally when it should be triggered constantly, to test this I set up a print for every time the event is triggered on the target and it is flickering between being triggered and not when the mouse is hovering over the target whilst not moving the mouse at all. With sometimes not being triggered at all despite the mouse clearly being over the target.
Here are images showing how it is organised (and in case it is important but it shouldn’t be according to: InputEvent docs as the unit node is lower then the map mode in the scene, the input_event for the map being clicked works the exact same way as shown here, apart from a different signal being sent).
- When I am able to select the unit and a position for the unit to move to on the map. The unit moves past the point, the mouse clicked at at and stops further away from it, going through the point on the map selected. I have tried to solve this by calculating if it goes through an area around the position the mouse clicked at which didn’t solve it but did show it calculating being much further away then it was.
Here are images showing how the code works for it.
Here is a video showing both error’s happening one after another (in order of my list): Link (as new users can’t upload attachments when I try uploading the video).
Any help would be greatly appreciated and thanks in advance.



