Files
ai-game-2/scenes/pasture/pasture.gd
2024-05-29 13:26:31 -07:00

39 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 healers = load("res://scenes/healers/healers.tscn")
var house = load("res://scenes/house/house.tscn")
func _on_house_exit_interacted():
var path = NavigationServer2D.map_get_path(self.map, self.pathfind.to_local($Graham.global_position), pathfind.to_local($"house-exit-point".global_position), true)
start_main_script(ScriptBuilder.init(ScriptBuilder.walk_path($Graham, path)).and_then(ScriptBuilder.transition(self, house, "pasture-exit-point")).can_interrupt().build(self, "_on_script_complete"))
func _on_forest_exit_interacted():
#var temp_healers = healers.instantiate()
var path = NavigationServer2D.map_get_path(self.map, self.pathfind.to_local($Graham.global_position), pathfind.to_local($"farmhouse-exit-point".global_position), true)
start_main_script(ScriptBuilder.init(ScriptBuilder.walk_path($Graham, path))
.and_then(ScriptBuilder.transition(self, healers, "pasture-exit-point"))
.and_then(ScriptBuilder.walk_to_deferred("pasture-exit-point", "pasture-entrance-point"))
#.and_then(ScriptBuilder.trigger_signal("entered_from_pasture"))
.can_interrupt().build(self, "_on_script_complete"))