While travelling to Microsoft HQ in Redmond earlier in the year for the annual TechFest event – for some fun I decided to have a go at writing a small retro game in F# using XNA 2.0, and attached are the results. When moving over to Pacific time I usually find myself waking up at 4am for the first few days, leaving me with plenty of wide awake hours I wouldn’t normally have to while away, and this is when the sample was born. I decided on an implementation of Lunar Lander basically because it is pretty simple both logically and graphically, and at the same time fun and achievable in a relatively short time. The sample lets you play with a game pad or keyboard (‘Z’ and ‘X’ to rotate, Space to thrust), and to complete the game you must land on the long flat section before you run out of fuel and hit the jagged terrain.
For those interested, the source is attached to this post, which comprises a Visual Studio 2005 solution, a C# XNA 2.0 shell project to take advantage of the content pipeline for audio, an F# game implementation project and a small utility project to create terrain vectors from points in an image file. Please feel free to download and play with it, in theory if you have XNA 2.0 and F# installed then you should be able to just load the solution and press F5 to build and run.