platformer-game-test/src/CutScenes/ChallengeCutscene.gd

93 lines
2.2 KiB
GDScript

extends CutScene
var _dialog_bubble = load("res://src/CutScenes/DialogBubble/DialogBubble.tscn")
var _old_man_dialog = [
{
"text": "Hi there young one!",
"callback": null
},
{
"text": "You do look stupid enough\nfor my challenge...",
"callback": null
},
{
"text": "Basically, you are already dead",
"callback": null
},
{
"text": "Sorry, you hear that from me\n But fear not!",
"callback": null
},
{
"text": "To redeam your self I crafted 10 challanges for ya",
"callback": null
},
{
"text": "You have ten minutes to complete them all and collect as many Coins and Orbs as you can",
"callback": null
},
{
"text": "You will fail, learn from your mistakes. Just try to fail as little as possible",
"callback": null
},
{
"text": "Questions?",
"callback": null
},
{
"text": "*COUGH* Anyway, Good luck, and mind you step!",
"callback": null
},
]
func start_scene(camera:CameraGame = null):
_started = true;
_main_camera_ref = camera
position = camera.get_global_transform().get_origin()
_camera = camera.duplicate()
add_child(_camera)
_main_camera_ref.current = false
_camera.current = true
$AnimationPlayer.play("start")
yield($AnimationPlayer, "animation_finished")
yield(get_tree().create_timer(.5), "timeout")
# Dialog 1
$AnimationPlayer.play("old_dude_slide_in")
yield($AnimationPlayer, "animation_finished")
var dialog_bubble:DialogBubble = _dialog_bubble.instance()
dialog_bubble.dialog = _old_man_dialog
$Overlay.add_child(dialog_bubble)
dialog_bubble.start_dialog()
yield(dialog_bubble, "dialog_finished")
$AnimationPlayer.play("old_dude_slide_out")
yield($AnimationPlayer, "animation_finished")
camera.get_parent().boost(Vector2(0,-200))
#
_on_scene_exited()
pass
# func _input(event: InputEvent) -> void:
# if not _started: return
# if Input.is_action_just_pressed("jump"):
# if allow_skip: _on_scene_exited()
func _on_scene_exited():
$Tween.interpolate_property(_camera, "position", _camera.position, _camera.get_parent().position, 2, Tween.TRANS_BOUNCE, Tween.EASE_OUT)
$Tween.start()
yield($Tween, "tween_completed")
_main_camera_ref.current = true
$AnimationPlayer.play_backwards("start")
yield($AnimationPlayer, "animation_finished")
end_scene()