extends Control export var blur: int = 3 export var blur_transition_duration: float = 1 var blur_amount: float = 0 var blur_step: float = 0 func _ready(): $ColorRect.visible = false blur_amount = 0 blur_step = blur / blur_transition_duration print("Starting state: ", $GameState.current_state_name()) func _process(delta): if blur_amount < blur: blur_amount += delta * blur_step print("blur: ", blur_amount) $ColorRect.material.set_shader_param("blur_amount", blur_amount) func _on_GameState_state_changed(previous, current): print("GameState: ", $GameState.State.keys()[previous], " -> ", $GameState.State.keys()[current]) match current: GameState.State.WINNING: print("Solved!") # TODO: wait for the animation to finish before game over #$GameState.transition_to(GameState.State.GAME_OVER) GameState.State.GAME_OVER: $ColorRect.visible = true $ColorRect.material.set_shader_param("blur_amount", blur_amount)