Godot Version
4.7
Question
I’m making a point-and-click visual novel game, sort of in the style of Ace Attorney, wherein each scene is a room with clickable objects. My dialog system currently works so that upon clicking an object (which is set up as a Sprite2D → CollisionArea2D → CollisionShape/CollisionPolygon), the empty dialog box (which is a CanvasLayer node) receives a signal from the Area2D, loads a JSON file, and displays the correct text.
The issue I am having is overlap in the Area2D, which is causing a click on both objects to be parsed even when the mouse is only clicking on one. I’m not sure how to fix this; ideally, the click would only be parsed when precisely on the clickable object, as some objects in the game are rather close together.
I tried custom setting the viewport object picking physics, and considered instantiating another signal from each Area2D to check the mouse’s hover location right before clicking, but couldn’t get it to work.
As this is my first game, I’m still getting things like signal implementation mixed up fairly often, so I would greatly appreciate any help or resources that might be good, as I haven’t found a ton in the way of this specific problem, and have combed through the official Godot documentation at length…
For a sample scene, I have this–two sprites and a textbox:
And the code for the Area2D on each sprite is as such:
extends Area2D
signal call_dialog
func _input(event: InputEvent):
if event.is_action_pressed("click"):
call_dialog.emit()
And, finally, this is dialog box script as:
# rightmost sprite
func _on_jooyeonclickarea_call_dialog():
print("first signal passed")
get_json(jsonsrc)
char_text.show()
speaker_name.show()
load_block(current_block)
#leftmost sprite
func _on_junhanclickarea_call_dialog():
print("second signal passed")
get_json("res://json/jh-demo.json")
char_text.show()
speaker_name.show()
load_block(current_block)
Thank you for any help possible… This seems to be the last major obstacle in implementing the basic player interaction for this game, so I’ll keep trying things as well, and I’m excited to hopefully get this sorted quickly..!

