Input(event) trouble

Godot Version



Hi everyone,

this function in my Sprite’s script works fine:

func _input(event):
   if Input.is_action_just_pressed("mousebuttonclick") && get_rect().has_point(to_local(event.position)):
      do something

Now I’d like this function to be “triggered remotely” by a button-press:

func _on_button_down():

Unfortunately this doesn’t work and an error is thrown: The identifier "event" isn't declared in the current scope.
How can I get this to work?

You will need an event in order to call the input function. You can technically make an event with Input.parse_input_event but I think it would be simpler to just wrap “do something” in a function and then call that function.

Thanks for your suggestions. I didn’t know about “parse_input_event”, but it appears quite promising!