taqin/src/Main.gd

30 lines
946 B
GDScript3
Raw Normal View History

2019-11-26 13:57:50 +01:00
extends Control
2020-01-12 19:49:25 +01:00
export var blur: int = 3
export var blur_transition_duration: float = 1
var blur_amount: float = 0
var blur_step: float = 0
2020-01-04 19:22:11 +01:00
func _ready():
$ColorRect.visible = false
2020-01-12 19:49:25 +01:00
blur_amount = 0
blur_step = blur / blur_transition_duration
2020-01-07 13:54:06 +01:00
print("Starting state: ", $GameState.current_state_name())
2020-01-04 19:22:11 +01:00
2020-01-12 19:49:25 +01:00
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)
2020-01-07 13:54:06 +01:00
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
2020-01-12 18:51:07 +01:00
#$GameState.transition_to(GameState.State.GAME_OVER)
2020-01-07 13:54:06 +01:00
GameState.State.GAME_OVER:
$ColorRect.visible = true
$ColorRect.material.set_shader_param("blur_amount", blur_amount)