0 votes

Hey guys,

I'm working on a tower def game and I'm working on my buttons here.
In my game, I have the button toggle working,it goes from on to off when you click on it or press 1.
Now, I want to be able to right click anywhere outside the button to toggle the button to "off"

I can't seem to find a way to get _input(event) working with the button toggles. any advice?

image included
https://ibb.co/8293Y2t

Godot version 3
in Engine by (12 points)

1 Answer

0 votes

Try

func _input(event:InputEvent):
    if event is InputEventMouseButton:
        var e:InputEventMouseButton = event
        if e.button_mask == BUTTON_RIGHT:
            $Button.pressed = false
by (636 points)
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 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 webmaster@godotengine.org with your username.