Small 2D game where the player completes platforming levels to collect eggs and avoids various obstacles including enemies, crushing machines and bottomless pits. The player can also take control of different vehicles, currently including a submarine to travel underwater areas to unlock new areas within levels.
This button can be used to either spawn a set number of objects or to open doors.
Getting the blueprint to work which allowed only the set number of objects to spawn, and to progressively delete the spawned objects as new ones are spawned was difficult!
I tried multiple solutions that got quite long. I ended up with a simple one using two functions that check whether the number of spawned objects is more than the number that are allowed to spawn and start to delete them based on the index they received when spawned.
This means that the first spawned object is deleted, the second spawned object is deleted second etc. An array is used for this effect!