Howdy! This question is in reference to a student rendition of the game Galaga: Code.org - Game Lab
To highlight the issue, please open the project and add a variable watcher for enemies.length and playerShots.length (or log them to the console).
Notice that when the enemies are hit by a projectile, both sprites disappear and everything appears to be working properly. However, notice that the length of the enemies group and the playerShots group is NOT going down. It appears that the sprites in these groups are continuing to exist, which eventually causes the game to lag. The code that SHOULD destroy the sprites is the for-loop on lines 226-235, but it seems like the sprite.destroy() method isn’t working as it should.
If anyone can help me understand what’s going on here, I’d be grateful!