Moves modifier logic to utilize a central StatsComponent for managing and applying stat modifications. This change centralizes stat management and simplifies the application of modifiers, enhancing code maintainability and reducing redundancy. It also moves modifier files to the correct directory.
22 lines
646 B
GDScript
22 lines
646 B
GDScript
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")
|