This repository has been archived on 2024-02-25. You can view files and clone it, but cannot push or open issues or pull requests.
Wol/ExampleDialogue/ExampleScene.gd
2021-11-27 22:05:24 +01:00

25 lines
943 B
GDScript

extends Node2D
var current_dialogue
func _ready():
$Sally/DialogueStarter.connect('body_entered', self, '_on_player_near_dialogue', [$Sally, true])
$Sally/DialogueStarter.connect('body_exited', self, '_on_player_near_dialogue', [$Sally, false])
$Ship/DialogueStarter.connect('body_entered', self, '_on_player_near_dialogue', [$Ship, true])
$Ship/DialogueStarter.connect('body_exited', self, '_on_player_near_dialogue', [$Ship, false])
func _on_player_near_dialogue(_player, node, entered):
print('body entered?', entered)
if entered:
current_dialogue = node.name
else:
current_dialogue = null
func _process(_delta):
if Input.is_action_just_released('ui_accept') and current_dialogue and not $Dialogue/Wol.running:
print(current_dialogue)
$Dialogue/Wol.starting_node = current_dialogue
$Dialogue/Wol.path = 'res://ExampleDialogue/%s.yarn' % current_dialogue
$Dialogue/Wol.start()
print($Dialogue/Wol.variable_storage)