Reputation: 151
How do I detect mouse clicks/mouse events in an Area2D's script? Do I use the func _process(delta) function? Let's say I have an area 2D called area. So what should the script be like? I want something like this:
extends Area2D
func _process(delta):
if mouse_touching && mouse_left_down:
print("clicked on object")
Upvotes: 2
Views: 7297
Reputation: 40295
If your Area2D
has input_pickable
then it will get a call to _input_event
when the user clicks it.
Upvotes: 2