Hello, I'm having an issue in my game where I'd like to have randomly spawning enemies acting independent of each other. Normally, this isn't a problem. I can just spread a value or use the ForEach object. But in my case, I have two separate objects for the enemy: The enemy hit box, and the enemy sprite. I attach the enemy sprite to the invisible hit box as I feel it makes for better game play.
My initial strategy was to spread values for both the sprite and the hit box's values "ID", but the problem with this came with events that came afterwards.
It would go something like:
ID of enemysprite = 0
ID of enemy = 0
> Set position of enemysprite to (0,0) enemy
But I would have to do this for each number. At points in the game, there can be upwards of 20+ enemies on screen due to random generation. With the above method, animations in particular would be very cumbersome to add in. I figured there had to be some quicker way to do this, but everything I've tried so far hasn't worked.
Here's what I tried:
Always
> Spread value 1 in ID for Enemy
> Spread value 1 in ID for Enemysprite
ID of "Enemy" = ID of "Enemysprite"
> *Do animation stuff*
This usually works briefly when an enemy is first spawned, but eventually the sprites stop following along with the enemy and the hit box goes rogue from the sprite. I end up with a bunch of spawned enemies moving independently of their sprites which should be following them. I am unsure if this is because I am constantly spreading values, but it seems to me like it starts out working and then for some reason fusion forgets that particular sprites and hit boxes are supposed to be paired together.
I have also tried spreading values when the object and sprite are first randomly spawned. That didn't work either. I have tried ForEach as well, but that seems to only work on single objects unless I am missing something.
The extra factor of making my sprites separate from the actual enemy hit box seems to be complicating things for me. Is there an efficient way I can handle multiple instances of the same randomly spawning enemy while maintaining sprites separate from their intended hit box?
I appreciate any help that can be offered!