Comments (3)
That problem doesn't appear to be in the current version of the project:
https://codesandbox.io/s/github/patorjk/JavaScript-Snake?file=/index.html
Looks like this line prevents the problem:
https://github.com/patorjk/JavaScript-Snake/blob/master/js/snake.js#L279
from javascript-snake.
that line is already in the code though
from javascript-snake.
So I was making my own snake game for a school project and happened to notice this funny little thing. Then I decided to see if other snake games had this. It still exists, but it's less than easy to pull off. Basically, because only two inputs are stored, if you manage to input three or more inputs before the next update, you can do a 180.
In my project, I solved this by storing them in a list instead. Realistically though, this is a minor issue, and you would only encounter this if you were deliberately trying to.
from javascript-snake.
Related Issues (20)
- vvbh
- Too Fast HOT 3
- Snake-game multiplayer HOT 4
- I need wasd keys PLEASE HOT 2
- No package.json HOT 1
- Make highscore be permanently visible at the bottom
- Input Edge Case Issue HOT 1
- Game crashes when snake fills up board HOT 6
- Highscore check doesn't seem to work anymore HOT 1
- Add pause button HOT 2
- Add gamepad support
- New Theme HOT 1
- Social links on bottom of page. HOT 51
- Wait for an arrow-key press after coming out of pause.
- Snake's head should be a different color. HOT 2
- Snake's body should be visibly joined together
- Theme selector dose not display correct theme
- Pause when user moves to a different tab HOT 2
- Add allcontributors section HOT 34
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from javascript-snake.