FantasyRun/world.gd

27 lines
670 B
GDScript3
Raw Normal View History

extends Node3D
2024-09-30 20:50:05 -07:00
@onready var character = $Character as Character
var change_distance: float
2024-09-30 20:50:05 -07:00
var tiles: Array[Tile]
var current_tile: int = 0
func _ready() -> void:
2024-09-30 20:50:05 -07:00
tiles.assign(Utils.get_nodes_of_class(self, Tile))
if tiles.size() == 0:
printerr("There are no Tiles in the scene.")
return
#change_distance = tiles[current_tile].length
if character.path == null:
2024-09-30 20:50:05 -07:00
character.path = tiles[current_tile].path
func _process(delta: float) -> void:
if is_equal_approx(character.follow.progress_ratio, 1):
2024-09-30 20:50:05 -07:00
current_tile += 1
if current_tile >= tiles.size():
return
2024-09-30 20:50:05 -07:00
character.path = tiles[current_tile].path
#change_distance = tiles[current_tile].length