How to use the input_event signal?

Hello, I’m using Godot 4.2.1 and I have a problem:

I have an area2D node who’s purpose is to detect mouse clicks, I try to do it by using the input_event signal, althougth I don’t know what parameters the parameters are or how to use them.

func _on_area_2d_input_event(viewport, event, shape_idx):
	if event is InputEventMouseButton:
		if event.is_pressed():
			if event.button_index == 1:
				print("like this?")

exactly like that, and it doesn’t work:

func _on_area_2d_input_event(_viewport, event, _shape_idx):
	print(event) # prints nothing
	if event is InputEventScreenTouch and !event.is_pressed():
		if is_egg:
			timesTouched += 1
			$anim.stop()
			$anim.play('hatch')


image
image
image

mouse is set to simulate touch

oh, weirdly it works when not instantiated, gotta update the instance

didn’t work yet…

oh. Area2D monitoring not working in Godot 4 - #2 by system