Phillip Trelford's Array

POKE 36879,255

Lunar Landurz

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.

Gravity

Use the Measure attribute to define your own measure types :

[<Measure>]
type m
[<Measure>]
type s

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

Code: https://bitbucket.org/ptrelford/lunarlandurz

References:

Comments (1) -

  • MBR

    1/7/2011 10:13:34 AM |

    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 Smile
    Tho' this is easier to play with analog controls for varied thrust...

Pingbacks and trackbacks (1)+

Comments are closed