Animations/Script bugged when multiple enemies instanced

Godot Version

4.3

Question

I have an enemy that attacks in a random direction using a randi_range(0,3) to set the corresponding animation in an animation tree. There is a windup animation that corresponds with a swing animation. This works with one enemy instanced but with more than one the windup animations become desynced from the corresponding swing animation, and creates weird jittery animations in general.

I have no idea what’s causing this. I assumed it was caused by all enemies running on the same script syntax but making the enemies local didn’t work, assuming that would fix it…

All help appreciated!

Video of the problem: https://www.youtube.com/watch?v=d-zKPaOVPBU

Seems like the wind-up animation is not unique to the enemy, maybe set the animation tree’s resource “Local To Scene”?

1 Like

Set the animation trees root resource to local to scene, problem persists

I was changing the animations in my animation nodes in the animation tree through code and this was what was causing the problem

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.