I know that in order to clean up your code you use loops. i.e. instead of saying
myItem = myArray[0]
my2ndItem = myArray[1]
up to element 100 or so will take 100 lines of your code and will be ugly.
It can be slimmed down and look nice / be more efficient using a loop.
Let’s say you’re creating a game and you have 100 non player controlled enemies that spawn in an EXACT position, each position differing.
How on earth would you spawn every single one without using 100 lines of code?
I can understand if, say for example, you wanted them all 25 yards apart, you could just use a loop and increment by 25.
So that said, programming statically in this case is the only way I can see a possible outcome, yet I know programming dynamically is the way to go.
How do people do this? And if you could provide other similar examples that would be great.
Spawn new enemy: