Point and Click character or object interaction

Godot Version

4.2.1

Question

I’m currently working on a point and click game and I’m trying to implement an interaction system.

The idea is that when you click on an npc(CharacterBody2D), the game will check if the player character(CharacterBody2D) is within the npc’s sight(Area2D), it the player is in its radius, it will automatically trigger dialouge, if not, then the player will move to the npc until it enters it and then, the dialouge will trigger.

Untitled

So far however, I haven’t been able to get a system like that to work. Does anyone have any ideas for scripting such a system?

so you mean click with the mouse? you can add a node or TextureButton with no texture to your npc character and detect mouse_clicks with it. Then check if player is in the area2d with the area-signals. Then you need a script where you can tell your player to move to a certain position