Wicked-Depths/node_2d.gd

56 lines
1.9 KiB
GDScript

extends Node2D
var dialogue
signal proceed
# Called when the node enters the scene tree for the first time.
func _ready():
$plr.can_move = false
$plr/AnimatedSprite2D.visible = false
if SaveHandler.settings["LoadSave"]:
$CheckPoints.current = get_node(str("CheckPoints/")+SaveHandler.settings["checkpoint"])
if not typeof($CheckPoints.current) == TYPE_NIL:
$plr.position = $CheckPoints.current.position
$cloud.enabled = true
$plr.can_move = true
$plr/AnimatedSprite2D.visible = true
var tweener2 = get_tree().create_tween()
tweener2.set_trans(Tween.TRANS_SINE)
tweener2.tween_property($plr/CanvasLayer/fadeout,"size",Vector2(1152,0),3)
$the_hole.play()
await tweener2.finished
return
var tweener2 = get_tree().create_tween()
tweener2.set_trans(Tween.TRANS_SINE)
tweener2.tween_property($plr/CanvasLayer/fadeout,"size",Vector2(1152,0),3)
$AudioStreamPlayer.play()
await tweener2.finished
dialogue = $plr/Camera2D/dialogue
#dialogue.dialogue("haiiii :3","",0.5)
await get_tree().create_timer(0.2).timeout
var tweener = get_tree().create_tween()
$fakeplr.play("move")
tweener.tween_property($fakeplr,"position",$plr/AnimatedSprite2D.global_position,5)
await tweener.finished
$plr/AnimatedSprite2D.visible = true
$plr/AnimatedSprite2D.play("idle")
$fakeplr.visible = false
$plr/Camera2D/dialogue.dialogue("The hole should be near me.","nervous",0.5)
$plr/Camera2D/dialogue.visible = true
await proceed
$plr/Camera2D/dialogue.dialogue("I hope what I read wasn't fake news.","upsidedown",0.5)
await proceed
$plr/Camera2D/dialogue.dialogue("I haven't got the chance to climb in a hole for a long time.","nervous",0.5)
await proceed
$plr/Camera2D/dialogue.visible = false
$plr.can_move = true
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if Input.is_action_just_pressed("interact") or Input.is_action_just_pressed("dialogue interact"):
print("hi")
proceed.emit()