slowly transition to game over
This commit is contained in:
parent
679b4839a8
commit
cf24e86781
|
@ -1,11 +1,22 @@
|
||||||
extends Control
|
extends Control
|
||||||
|
|
||||||
var blur_amount = 3
|
export var blur: int = 3
|
||||||
|
export var blur_transition_duration: float = 1
|
||||||
|
var blur_amount: float = 0
|
||||||
|
var blur_step: float = 0
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
$ColorRect.visible = false
|
$ColorRect.visible = false
|
||||||
|
blur_amount = 0
|
||||||
|
blur_step = blur / blur_transition_duration
|
||||||
print("Starting state: ", $GameState.current_state_name())
|
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):
|
func _on_GameState_state_changed(previous, current):
|
||||||
print("GameState: ", $GameState.State.keys()[previous], " -> ", $GameState.State.keys()[current])
|
print("GameState: ", $GameState.State.keys()[previous], " -> ", $GameState.State.keys()[current])
|
||||||
match current:
|
match current:
|
||||||
|
|
|
@ -53,5 +53,5 @@ anchor_bottom = 1.0
|
||||||
|
|
||||||
[node name="GameState" type="Node" parent="."]
|
[node name="GameState" type="Node" parent="."]
|
||||||
script = ExtResource( 3 )
|
script = ExtResource( 3 )
|
||||||
[connection signal="state_changed" from="GameState" to="." method="_on_GameState_state_changed"]
|
|
||||||
[connection signal="state_changed" from="GameState" to="HSplitContainer/Taquin" method="_on_GameState_state_changed"]
|
[connection signal="state_changed" from="GameState" to="HSplitContainer/Taquin" method="_on_GameState_state_changed"]
|
||||||
|
[connection signal="state_changed" from="GameState" to="." method="_on_GameState_state_changed"]
|
||||||
|
|
|
@ -185,6 +185,7 @@ func _on_GameState_state_changed(previous, current):
|
||||||
$Particles2D.emitting = true
|
$Particles2D.emitting = true
|
||||||
$Timer.start(-1)
|
$Timer.start(-1)
|
||||||
GameState.State.GAME_OVER:
|
GameState.State.GAME_OVER:
|
||||||
|
$Particles2D.emitting = false
|
||||||
$Timer.stop()
|
$Timer.stop()
|
||||||
|
|
||||||
func _on_Timer_timeout():
|
func _on_Timer_timeout():
|
||||||
|
|
Loading…
Reference in a new issue