DEV Community

loading...

JavaScript responsive snake game

vishesh
A never give up hard working programmer. I am full stack web developer (Angular, NodeJs, PHP, Wrodpress, Devops, AWS EC2, SNS, RDS, Lambda, SES, Cloudfront, etc...).
・1 min read

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.

Discussion (2)

Collapse
posandu profile image
Posandu

πŸ‘Ώ

πŸ‘Ώ

Collapse
vishesh profile image
vishesh Author

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