Can't get input events to work on my Aread2D scene

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By jahu00
:warning: Old Version Published before Godot 3 was released.

In my puzzle game, every time the user levels up, a popup is shown. I make an instance of an animated scene with an overlay.

The root of the popup scene is an Area2D and it has is a CollisionShape2D as its child. I have signal connected the input_event. I want to detect if any part of the popup scene was clicked and hide it. However the input_event is only called when the popup scene is initialized (possibly while the mouse button is still clicked), but doesn’t react to any inputs later on. Am I missing something?

I have similar setup for tiles in my game, but input_events work on all of the tiles just fine.

P.S. One of the children of my popup scene is a ColorFrame.

  1. Which version of the engine is this in?
  2. In Godot 2.1.x, CollisionObject2D._input_event is processed last, and only if the input has not already been handled by any of the other nodes (source). This could be related to the issue, but I won’t know without examining the scenes/scripts involved.
  3. Have you considered simply using a Popup-derived node instead of an Area2D for this? Using dedicated Control-derived nodes for handling UI input is going to help your project operate as expected much more easily than if you use collision-detection logic like an Area2D that is Node2D-derived.

Will Nations | 2017-10-29 04:04

It’s Godot 2.1.4 (the one one Steam).

Then I guess, it is possible that the input is already handled by the tiles (which have the same input_event setup, but actually work as intended).

I used a scene, because I wanted the popup to look fancy (animations and all).

jahu00 | 2017-10-29 10:58

if you can show the code on the area script, could be helpful, maybe you are not using the exact syntax for the method.

eons | 2017-10-31 01:44

:bust_in_silhouette: Reply From: jahu00

I found a workaround for my particular case. Since I want the popup to disappear if the player clicks anywhere, instead of using input_event I can just handle inputs in _fixed_process.

func _fixed_process(delta):
	#animated is set to true, when the popup is animated
	if (Input.is_action_pressed("ui_click") && !animated):
		queue_free()
		pass
	pass
:bust_in_silhouette: Reply From: jahu00

I finally figured it out (and tested it).

The reason why input events didn’t work was the ColorFrame (I used it as a background) . Once I set Ignore Mouse to true on the ColorFrame, I was able to handle the input events.