Wicked-Depths/holecutscene.gd

44 lines
1.6 KiB
GDScript3
Raw Permalink Normal View History

extends CollisionShape2D
# Called when the node enters the scene tree for the first time.
func _ready():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta):
pass
var done = false
func _on_area_2d_body_shape_entered(body_rid, body, body_shape_index, local_shape_index):
if done:
return
if body.name == "plr":
body.can_move = false
body.get_node("AnimatedSprite2D").play("idle")
var tweener = get_tree().create_tween()
tweener.tween_property(get_parent().get_parent().get_node("AudioStreamPlayer"),"volume_db",-100,2)
await tweener.finished
get_parent().get_parent().get_node("AudioStreamPlayer").stop()
get_parent().get_parent().get_node("the_hole").play()
var campos = body.get_node("Camera2D").global_position
var campos2 = get_parent().get_parent().get_node("CamPos").position
tweener = get_tree().create_tween()
tweener.tween_property(body.get_node("Camera2D"),"global_position",campos2,15)
await tweener.finished
tweener = get_tree().create_tween()
tweener.tween_property(body.get_node("Camera2D"),"global_position",campos,5)
await tweener.finished
var dial = body.get_node("Camera2D/dialogue")
dial.visible = true
dial.dialogue("Oh my.","upsidedown",0.5)
await get_parent().get_parent().proceed
dial.dialogue("I cannot believe my eyes.","normal",0.5)
await get_parent().get_parent().proceed
dial.dialogue("Well... Let's get down to business.","normal",0.5)
await get_parent().get_parent().proceed
dial.visible = false
body.can_move = true
done = true