extends CharacterBody2D @onready var collision_shape_2d: CollisionShape2D = $CollisionShape2D @onready var animated_sprite: AnimatedSprite2D = $AnimatedSprite2D var player_data = { "stats": { "health": 100, "speed": 3, "attack": 10, "defense": 5 }, "inventory": [], "name": "Hero" } func set_unit_position(x, y, z): var z_layer = z var x_position = x var y_position = y # Update the visual z-index directly animated_sprite.z_index = z_layer animated_sprite.position = Vector2i(x_position, y_position) print("Palyer Z-Layer: ", z_layer) func _process(_delta: float): play_idle_animation() func play_idle_animation(): animated_sprite.play("down")