DEV Community

Vishesh
Vishesh

Posted on

4

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.

Sentry blog image

How I fixed 20 seconds of lag for every user in just 20 minutes.

Our AI agent was running 10-20 seconds slower than it should, impacting both our own developers and our early adopters. See how I used Sentry Profiling to fix it in record time.

Read more

Top comments (2)

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

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

Heroku

This site is powered by Heroku

Heroku was created by developers, for developers. Get started today and find out why Heroku has been the platform of choice for brands like DEV for over a decade.

Sign Up

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay