serginator/snake
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|
Repository files navigation
/**
* Snake game to get more fluency programming in JavaScript.
* The first two games I wrote I was learning googling and reading a lot.
* After that I stopped writting code and started to study
* the book Javascript The Good Parts from Douglas Crockford. And when I
* finished it, then I started to make this one, in a complete different
* way of coding. Just check the code of Space Invaders and then check this
* one. I think this is more clean and professional, well documented following
* JSDOC, and maybe using some of the best parts of this language. Carlos Benítez
* from www.etnassoft.com helped me a lot "forcing" me to do the functions and
* methods in the correct way and to document it right. And also helped me solving
* closures problems and hoisting problems.
*
* Current Status:
* Playable.
* Increased performance by more than 50% using a buffer to draw
* outside the canvas and then drawing on the canvas just the complete image
* of the buffer. I'll use that on every game from now on.
* Refactorized several things, trying to avoid some redraws, drawing just
* when needed.
*
* ToDo
* · Solve Insane speed (SOLVED)
* · If you continue when you lose 3 lifes, the game continue forever
* like if you had infinite lives (SOLVED)
* · Try to catch more accurately the arrows (SOLVED MORE OR LESS)
* · Show the Score and the lives during game(SOLVED)
*
* @author Sergio Ruiz
* @version 1.1 01-05-2011 01:32
*/