DEV Community

Vishesh
Vishesh

Posted on

JavaScript responsive snake game

My first JS game - https://lnkd.in/gDG9Vhc

I have always been grinding to do the best side project.Most usefull one for interviews as well. But it takes toll after sometime. Hence, i worked and created something simple and fun.

This is a snake game. I tried to make it as much fun as possible. Please play and let me know. Some of its highlights are,

  1. Its completely responsive. Work in mobile and web.
  2. For mobile mode. i have developed a joystick which can be used for snake navigation. Its custom built and not copied or referenced from anywhere.
  3. It has sound effect. Just for fun.
  4. Its has humorous descriptions and funny messages.

Challenges

  • Responsive design - It was very challenging. I had to adjust canvas based on the size. On top of that i had to adjust the snake size as well. This completely alters calculations.
  • Joystick - Tried various other ways but joystick was difficult to design as it had to work in all mobile devices.
  • Random food - Generating a random number between the canvas sizes was also a challenge. But was not very difficult.

Top comments (2)

Collapse
 
Sloan, the sloth mascot
Comment deleted
Collapse
 
vishesh profile image
Vishesh

Ha ha... Sorry I wanted it to be funny 😝