Problem with Mouse detection (SOLVED)

Hello everyone!
I have a problem with my game buttons: it identifies the mouse approaching before the mouse is above the button sprite.
This is happening to every button in my game!
The Problem:
print_03
Gui viewport:
print_01
My script:


Video:


The worst thing is that when I want to select only 1 button, I end up selecting 2 or 3 as a visa in the video! Does anyone know where I’m going wrong?

The pick_node() function will check if the mouse is above the rectangular bounding box seen in the image around each button, not the exact pixels of the image used. Could this explain the problem?

2 Likes

I believe this is not the problem, as the image frame is practically the size of the button, the difference is a few pixels. I did a test project just to test the button code and this time it worked. :face_with_monocle:
Look:

Capturar 01

I think it’s something in my script… Can be! I will rewrite it and update the result here.

Sure, do that! If you still can’t figure it out then please share a minimal project here so someone can take a look.

1 Like

The image is this:
botao_Iniciar_01

But I discovered the problem, it was the code

gui.set_texture(self.start_btn, 'start_button');

I cleaned up my script and only when I disabled this line, the buttons started working normally!
I will close the question here and thank you so much for helping me! :grinning: :wink:

1 Like