Wicked-Depths/node_2d.gd

59 lines
1.8 KiB
GDScript3
Raw Normal View History

extends Node2D
var dialogue
signal proceed
# Called when the node enters the scene tree for the first time.
func _ready():
var plr = $plr
var fadeout = plr.get_node("CanvasLayer/fadeout")
var anim = plr.get_node("AnimatedSprite2D")
plr.can_move = false
anim.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
anim.visible = true
var tweener2 = get_tree().create_tween()
tweener2.set_trans(Tween.TRANS_SINE)
tweener2.tween_property(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(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",anim.global_position,5)
await tweener.finished
anim.visible = true
anim.play("idle")
$fakeplr.visible = false
dialogue.dialogue("The hole should be near me.","nervous",0.5)
dialogue.visible = true
await proceed
dialogue.dialogue("I hope what I read wasn't fake news.","upsidedown",0.5)
await proceed
dialogue.dialogue("I haven't got the chance to climb in a hole for a long time.","nervous",0.5)
await proceed
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()