24 lines
563 B
GDScript
24 lines
563 B
GDScript
extends Character
|
|
|
|
class_name Shadow;
|
|
|
|
var loop_origin : Loop;
|
|
var move_count := 0;
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
var player : Character = $"../Player";
|
|
player.has_moved.connect(_on_player_move);
|
|
|
|
|
|
func get_direction_input() -> Globals.Direction:
|
|
var result := loop_origin.move_list[move_count]
|
|
print(result);
|
|
return result;
|
|
|
|
func _on_player_move(direction: Globals.Direction):
|
|
print("MOOOOOOVE")
|
|
if move(get_direction_input()):
|
|
move_count += 1
|
|
move_count %= loop_origin.move_list.size();
|
|
|