Saturday, November 7, 2009

Snake Game [C#]

Hello again. I wrote a snake game in C#, let me tell you a little bit about it:

The game features two classes of sprites: Vertebra, representing a single snake link; and Pizza, which is, of course, the pizza.
Each of these classes inherits from the PictureBox class, and uses a Timer for a nice animation when these objects appear.

Game pause is achieved simply by start and stop of the game Timer.

There is a top 10 high scores, which is stored in an xml file.
This file is created automatically on the first time it is requested by the game.
The handling of the high scores is done with LINQ to XML, which is awesome!

Here is the code for the Main form:

Here is the code of the Vertebra Class:

And here are a couple of screenshots:

No comments:

Post a Comment