0

I dont know how to stop a game.plz see the 116th line of my code and help me to stop it.Thank you

https://code.sololearn.com/Wo3ik8EGza01/?ref=app

30th Jun 2020, 7:03 PM
Aditya sahani
Aditya sahani - avatar
2 Answers
+ 3
You just need to break out of your game loop. You could set a boolean in your if block after alert("lose") and then make an if block in your game loop that checks that boolean. If true break. Then maybe add a start button or try agian button that starts/restarts the game.
30th Jun 2020, 8:03 PM
ChaoticDawg
ChaoticDawg - avatar
0
Maybe you can add: alert("Try again"); snake.total=1; and then somehow clear all pixels the snake has coloured.... I dobt know more know as I dont know web and html...... Please tell me the result
30th Jun 2020, 7:57 PM
Alexander Thiem
Alexander Thiem - avatar