This is a basic example of how to build a Snake style game using pure JS and HTML5 canvas. This is just a demo and shouldn't be taken seriously. Please feel free to fork and or make PR's to make this better for fun!
Play live: https://glenhughes.me/projects/snake-js
The game is very simple. Just use the directional keys (up, right, down and left) to navigate around the game area trying your best to eat the yellow fruit. Each time you eat a piece a fruit, you get 1 point!
Install locally with GIT git clone [email protected]:GlenHughes/snake-js
Then go to that directory: cd snake-js
I use Yarn as my package manager, install Yarn and then type yarn
within the cloned directory.
Then type yarn dev
this assumes that port 8090
is free! Change this if you are already using it within the webpack/webpack-dev.js
.
Type yarn build
in the cloned directory! This will build a production version with no logs or dev related stuff and also a gzipped
version in the (or create) a /dist
.