2023-07-21 09:50:06 +00:00
|
|
|
#*
|
2023-07-23 16:16:52 +00:00
|
|
|
#* example_waypoints.gd
|
2023-07-21 09:50:06 +00:00
|
|
|
#* =============================================================================
|
|
|
|
#* Copyright 2021-2023 Serhii Snitsaruk
|
|
|
|
#*
|
|
|
|
#* Use of this source code is governed by an MIT-style
|
|
|
|
#* license that can be found in the LICENSE file or at
|
|
|
|
#* https://opensource.org/licenses/MIT.
|
|
|
|
#* =============================================================================
|
|
|
|
#*
|
|
|
|
|
2022-12-15 13:49:38 +00:00
|
|
|
extends Node2D
|
|
|
|
|
2023-07-23 16:16:52 +00:00
|
|
|
@onready var agent1: CharacterBody2D = $Agent
|
|
|
|
@onready var agent2: CharacterBody2D = $Agent2
|
2022-12-15 13:49:38 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _ready() -> void:
|
|
|
|
var waypoints: Array[Node] = $Waypoints.get_children()
|
2023-04-14 08:28:33 +00:00
|
|
|
|
2022-12-15 13:49:38 +00:00
|
|
|
for wp in waypoints:
|
2023-07-23 16:16:52 +00:00
|
|
|
agent1.add_waypoint(wp.global_position)
|
2023-04-14 08:28:33 +00:00
|
|
|
|
2022-12-15 13:49:38 +00:00
|
|
|
waypoints.reverse()
|
|
|
|
for wp in waypoints:
|
2023-07-23 16:16:52 +00:00
|
|
|
agent2.add_waypoint(wp.global_position)
|
2022-12-15 13:49:38 +00:00
|
|
|
|
|
|
|
|