Objective:
The objective is to have enemy spawners scattered around the map to spawn new enemies every X seconds (a feature already implemented). These enemies are 3D objects with a sprite containing animations being projected onto the 3D object's bottom face. The objective is to have every new enemy spawned have the correct animations based on their angle. Example:
If the enemy's angle is 45 degrees, the animation for that instance will be "Southwest_Idle", whereas if its angle is 0 degrees, the animation will be "East_Idle".
The angle is determined by the Enemy's position in relation to the player.
Current approach:
For every tick, I set an instance variable called "selfAngle" in the enemy 3D object to angle(Self.X , Self.Y, Player.X, Player.Y). Then, I compare the value in that instance variable to check if the number stored in there is greater or equal to an angle and less than another (e.g. >= 0 and < 30). If that is true, the program set the correct animation accordingly.
In terms of having the correct animation according to the angles, this is working.
Problem:
Since all the 3D objects being spawned reference the same single instance of the animation sprite, all the enemy instances face the same direction.
A possible solution that I thought of was to spawn a new instance of the sprite containing the animations and project that specific instance onto the new corresponding 3D object that was also generated. However, I have no idea how to do that and need help.
What could I do to solve this problem?
Link for the C3 Project: