extends Control export var blur: int = 3 export var blur_transition_duration: float = 1 var blur_amount: float = 0 var blur_step: float = 0 onready var taquin = $HSplitContainer/Taquin func _ready(): $ColorRect.visible = false blur_amount = 0 blur_step = blur / blur_transition_duration print("Starting state: ", taquin.current_state_name()) taquin.connect("state_changed", self, "_on_Taquin_state_changed") 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_Taquin_state_changed(previous, new): print("Taquin state: ", Taquin.State.keys()[previous], " -> ", Taquin.State.keys()[new]) match new: Taquin.State.WINNING: print("Solved!") # TODO: wait for the animation to finish before game over #$GameState.transition_to(GameState.State.GAME_OVER) Taquin.State.GAME_OVER: $ColorRect.visible = true $ColorRect.material.set_shader_param("blur_amount", blur_amount)