So I'm working on a project for a programming class where we have to make a functioning sidescroller. Enemies spawn frequently but after a while both enemies and bullets stop spawning. I can't figure out what the cause is, my only guess is the amount of objects on screen cause it to bug out but I tested this with a less intense version of the game and the same thing happened. The objects off screen shouldn't be despawning they are set to follow the frame so they don't disappear the bullets don't shoot far enough down to accidentally destroy them either. The enemies are meant to spawn on different timers and the bullets shoot upon the player pressing the spacebar if that helps any.
I would like to know whats causing this and if there is a way to fix it so this doesn't happen again.