UPDATED: Check out the writeup on the internals of the game: Slither Uncovered.
The typical retro Snake or Nibbles game consists of a snake and several food items, with sometimes the occasional set of poison items. The player navigates the snake about the game area through a series of quick smashing of arrow keys, attempting to eat only the food items. Each successful attempt increases the size of the snake. Depending on the version, the snake either dies by running into the game area borders or wraps around to the other side of the game area. In either case, the snake always dies when running into himself. However, while addicting, the game quickly becomes somewhat boring as you master each level. Over the years, there have been many versions that have raised the bar for all Snake-variants. Surprisingly, for such a simple game, there doesn’t appear to be many implementations using the HTML5 Canvas platform. On the contrary, with Flash there are several dozen. In any note, this post attempts to present Slither, my particular implementation of one of my favorite games from yesteryear.
This game is licensed under the GNU Lesser General Public Version 3 License (“LGPL”).
The game consists of a snake, which the player navigates around the game area to eat available food items on each level; should all be eaten, the player is advanced to the following level. Each level becomes more challenging by providing an assortment of poison items as well as level wall boundaries. However, certain levels also provide opportunity for upgrades, which will be explained later on. There are 7 levels in all.
Additional note: If the snake reaches the borders of game area, he is wrapped around to the opposite side of the game area (e.g. top goes to bottom, left goes to right, etc.).
This game is supported by all browsers except Internet Explorer; though further testing and support would be greatly appreciated.
- Left Arrow – Move left
- Right Arrow – Move right
- Up Arrow – Move up
- Down Arrow – Move down
- Escape – Pause game
- Enter – Resume game (un-pause)
- Eat all food items on a level to advance onto the next level
- Avoid poison items to maintain lives and upgrades
- Complete all levels to win the game
- Eating food items will grow the snake’s length and increase the player score based on the food item type and snake speed.
- Food Items:
- Mouse – Increases score by 3 × speed in points. Grows snake by 50% of speed.
- Grain – Increases score and snake growth by 20% of that received for a Mouse.
- Rat - Increases score by 10× that received for a Mouse. Grows snake by that received for Mouse plus 10%.
- Food Items:
- Eating upgrade items will apply enhancements to the snake’s abilities or adjust the game play (e.g. Time-Warp). These upgrades are categorized as either: Instant (applied instantly) or Progressive (applied to snake as a continuing enhancement). Progressive upgrade items remain applied until the snake collides with himself, a wall (except for Wall Breaker), or eats a poison item.
- Upgrade Items:
- Extra Life – Adds a life to the snake [instant].
- Time-Warp – Transports the player back to Level 1 with the same score, snake, and progressive upgrades. This allows for further potential points at the risk of losing before reaching the last level [instant].
- Shields Up - Allows for the snake to eat a single poison item minus the harmful side effects. This upgrade will be removed after eating the poison item [progressive].
- Wall Breaker - Allows for the snake to crash through any portion of a level wall without harm. Upon collision, all portions of the wall disappear from the level [progressive].
- Rat Paralyzer - Freezes any rats moving about on the level, allowing for easier capture. [progressive].
- Upgrade Items:
- Eating poison items will remove any progressive upgrades applied and may negatively impact the snake’s health or player score. Note: If the Shields Up progressive upgrade is applied, then the penalties are ignored for a single poison item.
- Poison Items:
- Deadly – Kills the snake, removing one life, and restarts the current level with the default snake length.
- Toxic – Decreases score by 20 × speed in points.
- Obnoxious - Simply removes any progressive upgrades applied.
- Poison Items:
The following is a list of the different walls that appear according to their respective levels:
Level 2 – Four Corners
Level 3 – Cross Hairs
Level 4 – Cross-Double Bar
Level 5 – Broken Square
Level 6 – Corner Sofas
Level 7 – Triple Tees
Okay enough explanation, if you would like give it a try, check out the following link: Play Demo.
Finally, for those who wish to see further details regarding the game’s internals, I’ll be writing up a post on that soon.