Skip to main content

Online Snake Game

This is a simple Snake video game I wrote over the past few days. For the graphics, I used my Firetools.js library, which I also mentioned in my Pong post.

To play the game, use the arrow keys on the keyboard (you might need to click on the game to give it focus). The world loops, so you can go out one side of the screen and come in the other. Eat 50 green pellets to win the game. Each time you eat a pellet, you will get longer and your score will go up; the longer you are, the more points you get for each pellet. If you don't eat enough pellets, you'll begin to starve, and get shorter. Cherries make you longer, but do not prevent starvation.

I did not add the ability to track high scores, but I might add that feature later on. Meanwhile, you can post your scores in the comments. Have fun!



New posts every month - subscribe for free!


Comments

Post a Comment

Popular posts from this blog

Which Hurts More?

212° F Let's play a little game. I'll list a bunch of possible actions. Each action will have 2 variations, (a) and (b). You choose either (a) or (b), depending on which would be safer (or less painful). Each of the questions will involve an oven hot enough to bake a cake (350° F), and a pot of boiling water (assume we're at sea level). So... would you rather: 1.     (a) Stick your hand in the oven     (b) Stick your hand in the boiling water   ... for a period of 10 seconds 2.     (a) Leave a fork in the oven     (b) Leave a fork in boiling water   ... for a period of 15 minutes. Then hold the fork tight with your bare hand. 3. Fill a jar to the top with cool tap water. Then:    (a) Place the jar in the oven    (b) Place the jar in the boiling water   ... for a specific, but unknown, period of time. Then remove the jar and put your hand in it. First see if you can figure these out yourself. They shouldn't be too...

2014 in Photos

The year of 2014 is over; the year of 2015 has begun. Over the past year, I took a lot of pictures - more than 1200 photos of clouds, bugs, plants, rocks, and more. I deleted most of the low-quality and repetitive photos. Then, I selected 20 of the remaining photos which I thought were the most interesting or significant. In this post, I'll include those photos, in chronological order. Spring 1. Cold Hummingbird I took this photo after a late snowstorm in Spring. In the days leading up to the storm, it was warm and sunny and the fields were green, so the snow came rather unexpectedly. During the storm, one of the hummingbirds at our feeder was covered in ice and could barely fly. This hummingbird was more fortunate, but unlucky nevertheless. 2. Green Landscape I took this photo on the side of a biking trail. I didn't edit or crop the photo - this is how it looked. 3. Indian Paintbrush The Indian Paintbrush is an unusual flower. What appear to be flower petals are actually brigh...

The Geminids

The Geminid meteor shower is coming up! At 2:00 AM, on December 14 (that's Thursday night, or Friday morning), you can see anywhere from 100 to 150 meteors per hour - depending on the sky and weather conditions. That's more than 1 meteor per minute! This particular meteor shower comes from a 5.1 km wide asteroid called 3200 Phaethon. Flecks of debris fall off this asteroid in a trail around the sun. These bits are called meteoroids . Every year, in December, Earth passes through this stream of meteoroids; when one of them enters Earth's atmosphere, it burns up and we see a meteor. If the meteor is brighter than Venus, it's called a fireball. Fireballs are much less common than meteors. This year, viewing conditions will be especially good; the peak occurs only 1 day past new moon. If you live in an area with lots of light pollution, you will definitely want to drive into the country. If you think the weather will be bad, go out a day or two before or after the peak. Kee...