0 votes

I need the player not to be able to move the blocks with swipes while the explosion chain is animating. And as soon as everything is over, the player will be able to control again.
For example, how can this be done in Defold:

msg.post(".", "acquire_input_focus") - subscribe to control

msg.post(".", "release_input_focus") - release control

I don't know how to do this in Godot's code. I only understand if I make a flag, but it's not very convenient to use it in my game.

Godot version stable 3.3.3
in Engine by (34 points)

2 Answers

0 votes

In any programming language You should do this by state machine system. You should do one state for full control and another for no control, and let the movement happen only under full control state.

by (8,099 points)

That's exactly what I did. But I wanted to know there is also a system method to disable accepting user input.

func boom() -> void:
    is_control = false
    var combo := 0
    for i in field:
        for j in i:
            if j.has_node("Bomb") and j.get_node("Bomb").boom():
                combo += 1
                if combo > 1:
                    $GUI/Combo.text = "combo x" + str(combo)
                yield(get_tree().create_timer(explosion_delay), "timeout")
   is_control = true
0 votes
by (889 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 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.