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

29 lines
1.1 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():
pass # Replace with function body.
# Called every frame. 'delta' is the elapsed time since the previous frame.
#func _process(delta):
# pass
func _on_south_exit_interacted():
var path = NavigationServer2D.map_get_path(self.map, self.pathfind.to_local(self.ego.global_position), pathfind.to_local($"south-point".global_position), true)
start_main_script(ScriptBuilder.init(ScriptBuilder.walk_path(self.ego, path)).and_then(ScriptBuilder.transition(self, load("res://background2.tscn"), "forest-exit-point")).can_interrupt().build(self, "_on_script_complete"))
func _on_forest_exit_interacted():
var path = NavigationServer2D.map_get_path(self.map, self.pathfind.to_local(self.ego.global_position), pathfind.to_local($"forest-exit-point".global_position), true)
start_main_script(ScriptBuilder.init(ScriptBuilder.walk_path(self.ego, path)).and_then(ScriptBuilder.transition(self, load("res://background1.tscn"), "forest-exit-point")).can_interrupt().build(self, "_on_script_complete"))