Hi.
Thanks in advance for reading this thread.
I’m trying to make an orb-like system on Unity2D where orb-like enemies rotate around the player and occasionally spawn a “blast” prefab. Thing is, the number of orbs need to be flexible and adapt to the amount of the proper caster enemies and they need to rotate around the player.
Rotation and dealing with the different number of enemies is easy (I’ve made an empty object positioned on the same spot as the player and got it rotating; and I’ll be using either a list or an array for keeping track of the enemies - probably the former), but I have no idea on how to implement the positioning of the orbs. Basically, I need them to position themselves at an evenly distance around the player and scattered around a circle (360º/number of orbs). Examples:
1 orb: 360º - in front of the player
2 orbs: 180º - one in the front and one in the back
3 orbs: 120º - a triangle with one at 12 o’clock, one at 8 and another at 4.
4 orbs: 90º - a diamond: 12, 3, 6, and 9 o’clock
5 orbs: 72º - a star
And so on.
They’d have to be children of the empty game object that rotates at the same position as the player.