iiitl / snake-game-js

0 stars 43 forks source link

#1 Implement Score and Max Score Feature #10

Closed 0PrashantYadav0 closed 5 months ago

0PrashantYadav0 commented 5 months ago

1

This PR enhances game logic by using snakeArray to track snake length. The current score is calculated as the length minus one (accounting for the head block).

Before displaying "Game Over", it compares the highest score in local storage with the current score. If the current score beats the highest, it updates the local storage.

On game start, it checks for the highest score in local storage. If found, it displays this as the present score; otherwise, it initializes to zero.

These changes improve user experience, providing clearer scoring and enabling players to beat their own best scores.

![Uploading Screenshot 2024-03-15 at 1.29.07 AM.png…]()

ANKITy102 commented 5 months ago

@0PrashantYadav0, please tag the issue id in the pr.

0PrashantYadav0 commented 5 months ago

@ANKITy102 DONE