XNA up and running

My install of XNA on Vista is up and running; here is the demo game I did for PCW Hands On:

In this exciting game, the magazine logo swings back and forth. Your task is to hammer the space bar at exactly the moment the logo is over the up arrow. Your score varies from 0 to 20 depending on how close the logo is to the up arrow.

Before you laugh uncontrollably at this hopelessly crude example, listen to my apologia. I set out to write a short printed article that showed how to create a working game in XNA. The XNA install comes with an example game called Spacewar, but even spacewar is too long and complex for a short article. My example has all the code in one file, the Game1.cs which is created by the project wizard. It is a real game, with a moving sprite, keyboard handler and scoring mechanism. The idea is that once you grasp how Stop the Logo works, you can easily move on to greater things.

The simplicity was a little spoilt by a silly problem: displaying the help text and score. There is no easy way in XNA to write text to the screen; at least, there wasn’t in the beta, and on a quick look there isn’t in the final release either. I used Gary Kacmarcik’s BitmapFont class; I notice he has posted some more resources since the beta so check out his blog.

 

Technorati tags: