devsargam / SnakeGame

A simple snake game made with vanilla javascript.
https://snakeinjs.netlify.app/
MIT License
29 stars 22 forks source link

[bug]: opposite direction only cause an crash if upwards #46

Closed xstable closed 2 years ago

xstable commented 2 years ago

Describe the bug It's not clear if the game should recognize if a user press the opposite direction. Means if snake goes from right to left, and user press right, ...should in this case a crash happen?

Nevertheless if yes or not, it's a bug, because this only happends if snake goes from bottom to top, and user press down arrow

To Reproduce

Steps to reproduce the behavior:

  1. snake direction to to
  2. press down arrow at keyboard
  3. Try the same with other directions (will not work)!
devsargam commented 2 years ago

@xstable thank you for your valuable bug report. <3 Should be an easy fix so I'll do it myself.

devsargam commented 2 years ago

fixed in #53