Skip to content
Sign UpLog In
This post is read-only. Explore Repls and connect with other creators on Community.View Community
The info in this post might be out of date, check out our docs instead. View docs
2

Level 2 to my game.

MartijnLustig
MartijnLustig

Dear Repl.it 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");
setup();
document.location.reload();

2 years ago

Voters

Comments

TopNew
1
Bookie0
Bookie0

Check this stackoverflow page out
Screen Shot 2021-03-18 at 9.59.17 AM

And this Quora page as well :)

2 years ago
1
Michael8910
Michael8910

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

2 years ago
Load more