Wicked-Depths/explorer.gd

30 lines
1.2 KiB
GDScript3
Raw Normal View History

extends CollisionShape2D
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
var cool = false
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
if Input.is_action_just_pressed("interact"):
if get_parent().get_parent().get_parent().get_node("plr") in get_parent().get_overlapping_bodies() and not cool:
cool = true
var body = get_parent().get_parent().get_parent().get_node("plr")
body.can_move = false
var dial = body.get_node("Camera2D/dialogue")
dial.visible = true
dial.dialogue("Hi, what are you doing here?","normal",0.5)
await get_parent().get_parent().get_parent().proceed
dial.dialogue("I'm just placing down flags and exploring, but I'm a bit scared to proceed.","explorer",0.5)
await get_parent().get_parent().get_parent().proceed
dial.dialogue("Why?","normal",0.5)
await get_parent().get_parent().get_parent().proceed
dial.dialogue("There are too many spikes ahead.","explorer",0.5)
await get_parent().get_parent().get_parent().proceed
dial.visible = false
body.can_move = true
await get_tree().create_timer(1).timeout
cool = false