summaryrefslogtreecommitdiff
path: root/game/transition/transition.gd
diff options
context:
space:
mode:
Diffstat (limited to 'game/transition/transition.gd')
-rw-r--r--game/transition/transition.gd33
1 files changed, 26 insertions, 7 deletions
diff --git a/game/transition/transition.gd b/game/transition/transition.gd
index 45daf65..563e6d1 100644
--- a/game/transition/transition.gd
+++ b/game/transition/transition.gd
@@ -3,22 +3,41 @@ extends Node2D
@export var speed_scale = 1.0
+signal finished_animation
+
@onready var animation_player = %AnimationPlayer
@onready var microgame_viewport_container = %MicrogameViewportContainer
-signal finished
-signal microgame_viewport_hidden
+var _lives = 0
+var _characters = []
func _ready() -> void:
animation_player.speed_scale = speed_scale
+ _characters = %Characters.get_children()
+ animation_player.play("RESET")
-func _emit_microgame_viewport_hidden() -> void:
- microgame_viewport_hidden.emit()
+func microgame_fade_out():
+ animation_player.play("microgame_fade_out")
+ await animation_player.animation_finished
-func show_win_animation():
- animation_player.play("win_transition")
+func microgame_fade_in():
+ animation_player.play_backwards("microgame_fade_out")
await animation_player.animation_finished
- finished.emit()
+
+
+func play_microgame_count(count: int):
+ %MicrogameCountLabel.text = "%03d" % count
+ animation_player.play("show_microgame_count")
+ await animation_player.animation_finished
+
+
+func play_result_animation(won : bool) -> void:
+ for c in _characters:
+ if (won):
+ c.play_happy()
+ else:
+ c.play_mad()
+ await get_tree().create_timer(0.5).timeout