<canvas> snake game


Isn’t the <canvas> element wonderful? In this experiment, I made a small snake game, with five speeds.

The script is actually adapted from a snake game I wrote for the TI-89 calculators in TI-BASIC, which is why the method may seem a bit… unusual.

Feel free to use the code, but attribution would be nice.

Oh and by the way, this game only works in canvas-supporting browsers, i.e. not Internet Explorer. There also may be bugs in non-Firefox browsers.