Topic was automatically imported from the old Question2Answer platform.
Asked By
VLAHIN
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.
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.
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.show()
$GUI/Combo.text = "combo x" + str(combo)
yield(get_tree().create_timer(explosion_delay), "timeout")
is_control = true