I normally ask in the chats for help but I thought I would also post here as it’s quite a large project for someone to skim through.
The game runs as expected (although quite slowly on codepen), you can play it through and win with no problems.
However, if you fail on the first loop then, after the ‘game over’ alert pop up, the game continues playing. I noticed this after adding trying to add a lives system and it really put a spanner in the works.
However, if you fail on any loop after the first, then it doesn’t show this behaviour.
I know it must be a very simple hole in my logic that more than likely is a problem with the ‘start game’ button but I honestly have exhausted every option that I’m aware of (as I said, hours of trying).
The code is here, thanks in advance,
If you need me to explain anything then I’ll be happy to (hopefullly my code is clean enough to understand, even if it’s in dire need of refactoring).
EDIT: To clarify just a tiny bit more. If you deliberately fail on the first loop after starting the game, then look at the level counter (the number below) you will notice it increment and another iteration of the game will play. Instead, it should stop and stay at level 1.