I have function spawnEnemies that I use to spawn a wave of enemies. I passing some wave metadata like X, Y, wave size, angle as function params and store it in the local variables. I have to store it in local variables because I use these values in the For Loop. In the loop, I can't access to Function.Param(x).
Basically, it works well until I call two or more spawnEnemies functions at the same time. In that case, the second call overrides local variables and enemies from the first call will have params from second.
Is there a way to "lock" values in the function calls?
Or may another suggest to handle it?