How to make a button out of an Area2D and a CollisionPolygon2D?

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By miko

So, I’m making a 2D free-roam FNaF fangame, and am currently working on the navigation system. The way I intend it to work is that in every opening and interactable object has an invisible button, with it’s collision shape suited to the object shape. I am trying to do this with an Area2D and a CollisionPolygon2D, since I am not using physics and a polygon lets me customise the shape.

The problem is, I don’t know how to script the Area2D to respond to clicks.

TLDR; I need a way to use an Area2D as a button.

Thanks in advance!

This thread seems to have covered this question nicely:

https://forum.godotengine.org/22606/how-ive-handled-area2d-mouse-click-not-question

denxi | 2020-02-18 14:05