With the quit functionality added to the _process function, it won’t be reached if we are currently exploding or celebrating a level win.
An easy fix is to remove all “set_process(false)” and instead use the check for “is_transitioning” in _process as the second thing it does, after the “ui_cancel” input handling.
2 Likes
I don’t quite follow your fix. You removed set_process(false) from the win and fail states and used is_transitioning under the “ui_cancel” input?
The func _process then looks like this:
func _process(delta: float) -> void:
if Input.is_action_just_pressed("ui_cancel"):
get_tree().quit()
if(is_transitioning):
return
# input handling here ...
But now I might prefer a different solution:
In later parts of the course, we worked with an _input func. So, starting from Bram’s code, it would just require adding the _input func and moving the handling of the ui_cancel input there:
func _input(event: InputEvent) -> void:
if event.is_action_pressed("ui_cancel"):
get_tree().quit()
1 Like