Phil Trelford's Array
POKE 36879, 255

Lunar Landurz

January 6, 2011 22:03 by phil

In F# integer and floating point values can be associated with units of measure, typically used to indicate lengths, mass, etc. F# units of measure give compile time type safety with no runtime performance penalty!.Below is a playable Silverlight mini-game that applies units of measures in F# to 2D game mechanics.

Keys: Z = Left, X = Right, Space = Thrust


To complete the game you must land your craft on the flat ground (to make it a little easier the speed of landing and the orientation of the craft are not significant.

Note: this is a port of an XNA sample I wrote back in 2008.


Use the Measure attribute to define your own measure types :

type m
type s

module Gravity = 
    let Earth = 9.8<m/s^2> // Standard Gravity
    let Lunar = Earth / 6.0 



Categories: .Net | F# | Silverlight
Actions: E-mail | Permalink | Comments (2) | Comment RSSRSS comment feed


January 7. 2011 10:13


Nice... - I love vector gfx games - to me they're still more compelling than fully shaded/textured gfx.
Let's see some gfx for the main and retro thrust :)
Tho' this is easier to play with analog controls for varied thrust...


May 26. 2012 12:45


GOTO Copenhagen 2012 Conference

GOTO Copenhagen 2012 Conference

Phil Trelford's Array

Add comment

(Will show your Gravatar icon)

  Country flag

  • Comment
  • Preview