Home | About | Apps | Github | Rss

Raphael snake

RaphaelJS is an interesting SVG based javascript graphics library for the web browser, provides an intuitive and easy to use way to draw elements, animate them, add event handlers, etc. It even lets us plug in event handlers from other libraries such as YUI, jQuery. Inspite of apparent advantages in Canvas tag, one thing about SVG which can make a designer cry in happiness is, it works on IE. Period.

As i started to explore raphael for a module on espnf1, it tempted me to write a snake game as always i did when i was learning other libs such as pygame, sdl, etc.

Using just Raphael.js for the vector graphics to display the snake and jQuery for handling the keystrokes and other little things, It was entirely written in JavaScript, as a lunch time project, and timed myself at 2 hours. It can be accessed here -

http://kalyanchakravarthy.net/projects/fun/rsnake/snake.html

Feel free to view the source and do whatever you fancy.

PS : Use to start, pause, resume the game. And if u feel like, post ur scores as comments


More posts