extends Node2D

# Burn Debuff Visual - Shows burning animation on player/enemy

@onready var sprite = $Sprite2D

var animation_timer: float = 0.0
var current_frame: int = 0

func _ready():
	if sprite:
		sprite.frame = 0
		current_frame = 0
		animation_timer = 0.0
		# Ensure sprite is visible and positioned correctly
		sprite.z_index = 5  # Above player/enemy sprites
		sprite.visible = true
		print("DebuffBurn: sprite visible: ", sprite.visible, ", z_index: ", sprite.z_index)

func _process(delta):
	if not sprite:
		return
	
	# Animate through frames 0-15 (4x4 grid) at ~10 FPS
	animation_timer += delta
	if animation_timer >= 0.1:  # ~10 FPS
		animation_timer = 0.0
		current_frame = (current_frame + 1) % 16
		sprite.frame = current_frame
