extends Control var congrats_text_bottom = tr("CONGRATS_TEXT") var jumped_back = false func _ready() -> void: var congrats_text = tr("CONGRATS_SHORT") + Global.player_name + "!\n\n\n\n\n" $Panel/Label.text = congrats_text Input.set_mouse_mode(Input.MOUSE_MODE_VISIBLE) $Panel/SubViewportContainer/SubViewport/astronaut/Armature/Skeleton3D/Cube_001.mesh = load(Global.mesh_resource_player) await get_tree().create_timer(3.0).timeout $AnimationPlayer2.play('walk') $Panel/SubViewportContainer/SubViewport/astronaut/AnimationPlayer.play('walk') $Panel/SubViewportContainer/SubViewport/helper/AnimationPlayer.play('walk') func _on_button_pressed() -> void: get_tree().change_scene_to_file("res://title_screen.tscn") func _on_animation_player_2_animation_finished(anim_name: StringName) -> void: if anim_name == 'walk': $Panel/SubViewportContainer/SubViewport/astronaut/AnimationPlayer.play('jump') $Panel/SubViewportContainer/SubViewport/helper/AnimationPlayer.play('jump') $AnimationPlayer2.play('jump') if anim_name == 'jump': if not jumped_back: $AnimationPlayer2.play_backwards('jump') jumped_back = true else: $AnimationPlayer2.play('turn') if anim_name == 'turn': $Panel/SubViewportContainer/SubViewport/helper/AnimationPlayer.play("happy3") $Panel/SubViewportContainer/SubViewport/astronaut/AnimationPlayer.play('jump1') $AnimationPlayer2.play("jump_player") func _on_animation_player_2_current_animation_changed(name: String) -> void: if name == 'jump_player': await get_tree().create_timer(1.749).timeout $AnimationPlayer2.stop() $Panel/SubViewportContainer/SubViewport/helper.play_idle() $Panel/SubViewportContainer/SubViewport/astronaut/AnimationPlayer.stop() $Panel/SubViewportContainer/SubViewport/astronaut/AnimationPlayer.play("idle")