Files
ai-game-2/scenes/archive/entrance/entrance.gd
2026-02-20 23:02:47 -08:00

36 lines
1.4 KiB
GDScript3

extends Scene
# Declare member variables here. Examples:
# var a = 2
# var b = "text"
# Called when the node enters the scene tree for the first time.
func _ready():
super()
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
var farmhouse = load("res://scenes/farmhouse/farmhouse.tscn")
var bedroom = load("res://scenes/bedroom/bedroom.tscn")
func _on_bedroomexit_interacted():
var path = NavigationServer2D.map_get_path(self.map, self.pathfind.to_local(self.ego.global_position), pathfind.to_local($"bedroom-exit-point".global_position), true)
start_main_script(ScriptBuilder.init(ScriptBuilder.walk_path(self.ego, path)).and_then(ScriptBuilder.transition(self, bedroom, "entrance-exit-point")).can_interrupt().build(self, "_on_script_complete"))
func _on_farmhouseexit_interacted():
var path = NavigationServer2D.map_get_path(self.map, self.pathfind.to_local(self.ego.global_position), pathfind.to_local($"farmhouse-exit-point".global_position), true)
start_main_script(ScriptBuilder.init(ScriptBuilder.walk_path(self.ego, path)).and_then(ScriptBuilder.transition(self, farmhouse, "entrance-exit-point")).can_interrupt().build(self, "_on_script_complete"))
func _on_Node2D_interacted():
start_main_script(ScriptBuilder.init(ScriptBuilder.say(self.ego, "A little light reading.")).can_interrupt().build(self, "_on_script_complete"))