Phil Trelford's Array
POKE 36879, 255

Missile Command

December 7, 2010 00:26 by Phil

Just for fun, a clone of the 1980s arcade game Missile Command written in F# and deployed in Silverlight.


A language feature I have repeatedly found useful for games is state machines as sequences using yield. The following is used to define the path of explosions:

static member Path radius = seq {
    for i in [50..2..100] do
        yield radius * ((float i / 100.0) ** 3.0)
    for i in [100..-1..0] do
        yield radius * ((float i / 100.0) ** 3.0)
    }

 

References:

MissileCommand.zip (4.65 kb)


Tags:
Categories: F# | Silverlight
Actions: E-mail | Permalink | Comments (0) | Comment RSSRSS comment feed

Comments

Add comment


(Will show your Gravatar icon)

  Country flag

biuquote
  • Comment
  • Preview
Loading