Ask coding questions

← Back to all posts
Level 2 to my game.
MartijnLustig (0)

Dear community,

I have (partly) written a breakout game, the game works fine (apart from some glitches I'll fix later on). But now I want to create a level 2 to my game. Right now when you win it will just run setup(); and your level will just start over.

Now I have created a new file within my repl called: "Script level 2.js" and I'd like to run the code within that file when you win the first level. My question is: Is this possible?

The code to winning the first level looks like this right now:

if (score == brickRowCount * brickColumnCount) {
alert("LEVEL 2");

MikeJMS8910 (106)

the way that you are doing it won't work because when you refresh the screen it also starts over the code.