Play the game on my personal website. There is also a highscore feature there.
To play the game, just open <example.html> in your favourite modern gecko- or webkit-based web browser like Firefox, Safari or Chrome.
If you want to include the game on your own site, follow these steps:
First make sure to include <snake-js.js> in the
<head> section of the HTML file:
Then create an element for the game somewhere in the HTML
In this function, first retrieve the parent element (this is where the game will be rendered) as a DOM element. Then create the
SnakeJS object and pass the parent element to the constructor.
Check <example.html> for a sample implementation of the game. It also contains some information about changing game settings and how to use Snake JS properly with jQuery.
Oh, and please put a link to the github project if you make it pulic.
This purpose of Snake JS is (in this order)
- to adapt new web techniques, like the HTML5 canvas element
- to create an extremely entertaining game.
The purpose is not to make the game cross-browser compatible. Hacks and inconsistensies are only applied when absolutely necessary.
Currently Snake JS does not work on Internet Explorer. This is because IE is a non-standards compliant browser which does not support things like
DOMObject.addEventListener(). IE is like a spoiled child, and I refuse to treat it differently. Partly because I don't want to bloat the code or use extrenal libraries and partly because I just don't feel for it.