This code will check update score when it eats food by 1 and when the game is over it will check if the current score is grater than maximum score if yes then it will update the maximum score by score
CHANGES MADE:
added an element score and increasing it by 1 when it eats food and updates it on the page
added an element higsc which will be the maximum of score and higsc and updates it on the page
Uploading Screen Recording 2024-03-18 at 12.15.00 AM (1) (1) (1) (1).mov…
1
This code will check update score when it eats food by 1 and when the game is over it will check if the current score is grater than maximum score if yes then it will update the maximum score by score
CHANGES MADE: added an element score and increasing it by 1 when it eats food and updates it on the page added an element higsc which will be the maximum of score and higsc and updates it on the page
Uploading Screen Recording 2024-03-18 at 12.15.00 AM (1) (1) (1) (1).mov…