I'm currently programming a game at the moment, and what I'm currently trying to do is replace multiple "objects" in the game by using a loop.
When I say "objects" I'm not referring to an object in OOP, but a simple entity in my game that is drawn on the buffer (example: a rock or a tree).
Now this method of replacing objects works just fine if it's only a few objects, but if I'm trying to replace up to 25+ objects it looks a bit weird.
What I mean by that is you can see each object being replaced one at a time, rather than all at once. (I understand that this is because the task is executed in a loop)
This pretty much sums up what I'm doing, programmatically:
for(int i = 0; i < tilesToReplace; i++) //Looping through the total amount of tiles that will be replaced
//Spawning an object in the desired tile
spawnObject(objectPatch.objectId, //irrelevant, (new object ID)
objectPatch.coords[0][i], //irrelevant, X Coordinate of the current index
objectPatch.coords[1][i]); //irrelevant, Y Coordinate of the current index
I've already thought about doing something such as pausing the entity rendering until all of the objects I want to replace are initialized, but I'm wondering if there's a simpler way of doing this, such as a way of handling a loop that I'm not aware of. (I'm not really aiming for changes I can make with my object/rendering handling, etc.)