I want to spawn in a projectile in a scene by preloading the projectile in a PackedScene variable and then spawning it when I press enter like this:
“CRUSHER” is the packed scene. For this projectile I have set up an animation player that makes it at first creep into the screen and then fly past it. However I want the projectile to spawn from a random side of the screen and so I would have change the animation according to that. Here’s how I do it:
It works perfectly, except for one weird thing:
If I spawn multiple at the same time it seems that the animation of the last one I spawn overwrites the animations of the previous and they follow it. I thought they were separate from each other? For some reason changing the AnimPlayer for one through code changes it for all the others. I know they are the same scene but aren’t they different objects? It might just be me not understanding how this works but it would be great if someone what I’m doing wrong.
Here are the images on imgbb incase they don’t show up:
I found a way to get it to work. I make a duplicate of the animation, change its animation, add it to the AnimPlayer and play it. You still have to set it so it’s local to the scene otherwise it won’t work.