add game state

This commit is contained in:
Fabien Freling 2020-01-07 13:54:06 +01:00
parent fb287b8264
commit efb9a4e9d9
5 changed files with 50 additions and 10 deletions

View file

@ -2,12 +2,17 @@ extends Control
var blur_amount = 3
enum State {}
func _ready():
$ColorRect.visible = false
print("Starting state: ", $GameState.current_state_name())
func _on_Taquin_solved():
print("Solved!")
$ColorRect.visible = true
$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)