I have been struggling with this for quite a while. I have implemented an answer from my previous discussion and tried different variants and nothing seems to work.
Right now I'm at a point where at least the game doesn't break with a critical error, but Godot doesn't seem to be detecting any events at all. This is what I currently have:
@onready var Sprite = get_node("SpineSprite")
func _ready():
Sprite.get_animation_state().set_animation("Front idle not possessed", true, 0)
Sprite.connect("animation_event", Callable(self, "_on_animation_event"))
func _physics_process(delta: float) -> void:
if lastangle >= -0.392 and lastangle < 0.392: # Right (0° to 45°)
is_looping = false
new_animation = "Side Attack no possessed"
new_scale_x = 0.4
attack_timer = false
$"Can Attack".start()
if current_entry == null or current_entry != new_animation:
Sprite.get_animation_state().set_animation(new_animation, is_looping, 0)
Sprite.scale.x = new_scale_x
func _on_animation_event(track_index, event):
print("event called")
#and distance_to_target <= attack_range
#if event.string_value == "Attack":
if target.is_in_group("enemy") or target.is_in_group("breakable"):
player_velocity = velocity
target.hit(damageplayer, player_velocity)
The animation is playing so I know for a fact the events should be called, but not even the _on_animation_event function is getting called as the print statement is not getting called either.
Can someone help me please?