Garden 2 March updates
Enemy respawn when resting at a save point
To make enemies respawn when the player rests at a save point, I went back to the enemy spawner and created an event that spawns new enemies in place of defeated ones. It simply goes through an array of killed enemies checking if they should be respawned and then removes the enemy from the array.
![]() |
| The event that respawns enemies. |
To prevent duplicate enemies from spawning when resting after loading the level, I created a second event that clears the respawning enemies from the array when the level is loaded.
![]() |
| Clearing respawning enemies from the killed enemies array. |
I noticed that removing an item from an array that is being looped through caused the next item's index to drop by one and it would not be included in the loop, always "skipping" the next index after an item is removed. So any changes are made in a temporary copy of the array and after the whole loop is finished the original array is updated with the information from the copy.

