NotYourAverageSnake is an enhanced and modern twist on the classic snake game. While preserving the nostalgic charm of the original, it introduces exciting features like bombs, shields, and poisoned apples.
Live Demo: NotYourAverageSnake
- HTML
- CSS
- Javascript
- Classical snake gameplay with modern touch
- Introducing bombs, shields, and poisioned apples for dynamic gameplay
- Mobile-friendly design for gaming on the go
- Game UI and sound effects
It initially started as a mini weekend project to learn about canvas api. But then I decided to take it a step further and add other features such as poisionedapples, bombs etc.
With the addition of new features, the codebase started growing. So I seperated the code from a single file into multiple files. A seperate file for all the global variables and functions. A seperate file for the initilisation of the game and running the gameloop. And other components of game like the snake, food, audio into its own seperate file.
Once the game was complete, I added support for touch screen devices as well and created a simple game UI. Also I implement score and highscore functionality using localStorage.
- Object Oriented Programming
- How to create and use classes
- Inheritance
- Single Responsibility Principle
- Seperated responsibility into its own class
- Extracted that class into its own module
- Interface Segregation Principle
- A class is not forced to implement a interface which it does not use
- Canvas API
- How to setup canvas
- Draw 2D shapes and images on it
- Make shapes and images move
- Collision Detection and gameLoop
- Mobile Support
- How to enable mobile-friendly gameplay using 'touchstart' event listner
- localStorage API
- Getting and setting short bits of data
- Audio
- Finding and using Audio in game
- The code can be further optimised
- More Props could be added
- Implementing the functionality to host local game rooms and leaderboards
- Better UI and sound effects
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.