0 votes

Hallo
I have 2 buttons and wait if both are pressed.

yield(_on_Button1_pressed)
yield(_on_Button2_pressed)

But if the user turns the order when pressing?
How can I query both variants?

in Engine by (29 points)

1 Answer

0 votes

I can try this

func my_func():
        yield(button_func(), "completed")
        print("All buttons were pressed, hurray!")

func button_func():
    yield($Button0, "pressed")
        yield($Button1, "pressed")

for more detail at Coroutines & signals

by (316 points)
func button_func():
  yield($Button0, "pressed")
    yield($Button1, "pressed")

Gives : Unexpected ident.
That's why my question.

this error happen because there are some spaces before yeild, they are not tabs.
you need to replace all spaces before yeild to tabs
enter image description here

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.