extends Resource
class_name PlayerCombat

var player: CharacterBody2D
var animated_sprite: AnimatedSprite2D

func process(_delta):
	if Input.is_action_pressed("fire"):
		var mouse_position = player.get_global_mouse_position()
		var player_position = player.global_position
		var direction = mouse_position - player_position
		var normalized_direction = direction.normalized()

		player.ranged.fire(normalized_direction, mouse_position)
		# Update animation
		#update_animation()

func update_animation():
	Log.pr(animated_sprite.animation)
	if animated_sprite.animation != "throw":
		Log.pr('Throwing animation!')
		animated_sprite.play("throw")
