mouse_entered & button click

MungMoongMungMoong Posts: 28Member

I created a button using a Texture button node

To create a button to be pressed, I assigned a separate texture for the 'nomal button' and 'pressed button'

I created a variable to prevent the screen from being accidentally clicked by the button

The screen changes when the button is pressed and released, but when the button is pressed and released away from button, the screen is not moved

So we created a variable using the mouse_entered and mouse_exited signals

But when the button is clicked, the mouse_exited signal appears to be invalid

In this case, how do I modify the button node?

And do the signals like the mouse entered mouse exit work the same on the smartphone?

Answers

  • wombatstampedewombatstampede Posts: 72Member
    edited February 9

    Normally, you won't receive mouse related signals on a touch device like i.e. Android. Unless you actually connect a mouse or touchpad to the device (which is possible, at least for Android).
    But you'll receive other signals like "button_pressed" also when the button is pressed by Touch.

    But since Godot 3 there's an option to emulate the mouse via touch (see project preferences).
    My guess is that mouse movement won't be emulated here unless you actually drag your finger across the screen (with contact).

    Anyway. I don't really understand what you're trying to do/avoid by using the mouse enter/exit signals. This term "pressed away from button" is completely unclear to me. There will be no button_pressed event on the button when you miss it (and press elsewhere)...

    Perhaps other people understand better than me...

  • MungMoongMungMoong Posts: 28Member
    edited February 10


    like this

    Click the button to change the background color

    One sentence that you can not understand is actually a sentence I wrote because the translator did not work properly

    I am thinking of a feature to prevent miss clicks

    I can not create a debug key and I'm testing it on my pc before testing it on Android

    So when I configure the script with the nodes related to the mouse and test it on Android, I'm studying how to change it

    button pressed and button up signals already used

    Instead, we created a variable to make sure that the scripts in the up signal are not executed when the mouse button is released after moving the cursor away from the button.

    ↑ It seems to have been translated smoothly.
    I should have written something like this

Sign In or Register to comment.