0 votes

I'm working on my first game with Godot. I've watched videos and read a bunch, but I can't figure this out!

I am making a puzzle game where I need clickable tiles. I created a node that is an Area2D containing various sprites, a label, an animation player, and a CollisionShape2D so that I can use the inputevent signal. When I run the tile scene by itself, the signal works, but when I place the tiles in the main game scene, the inputevent function doesn't seem to be called. The input_event signal is connected to the node itself. Below is the code, I'm not even having it do anything right now except print to the output tab just to try it out.

func _on_ItemTile_input_event(viewport, event, shape_idx):
    if event is InputEventScreenTouch:
        if event.is_pressed():
            print("object click" + str(item_number))
            print("object release" + str(item_number))
Godot version 3.4.2
in Engine by (12 points)

What may be happening is that other nodes in the scene are intercepting the input before the tile scene (e.g. some other Control node). That's happened to me before. But I was using mouse input, not touch input. Nevertheless, it's good to check the Mouse Filter property of any other Control nodes in the main scene.

Bingo! I figured it was something like what you said, something intercepting the input, but I didn't know about the Mouse Filter, and that's exactly what it was! I had a background image, and the filter was set to stop. I set it to ignore and it started working. Thanks!

Please log in or register to answer this question.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.