Javascript final project, stuck on text game with 2d game

Hi there,

I have been working on the final project and creating a game for my nephew.

It starts off all text based but I wanted to make it more complicated so I have decided to try and input a game or two that is 2D.

My first one is in but the issue I am having is this;

The game starts text based and moves into a 2D challenge. When this challenge is completed, I want it to move to more text based game following on from previous.

If the user does not complete the challenge, I want the game to restart the 2D game and not the whole game which is what is happening right now.

Here is the code: https://gist.github.com/codecademydev/57f09b3f49acec356d63b67eae4981aa

And the HTML for it: https://gist.github.com/codecademydev/cff9a93f60531c10f56dcff6ffb8fc87

The part that makes the whole game reload in both circumstances is;

document.location.reload();

Now I don’t know how to change this in order to achieve what I want.

Perhaps some sort of function within that function instead?

Any help would be much appreciated!

Thanks,

Jose