Skip to content

Instantly share code, notes, and snippets.

@paytonrules
Created January 17, 2017 01:48
Show Gist options
  • Save paytonrules/c00a7fb6c813aefc29375c7ac050bdf8 to your computer and use it in GitHub Desktop.
Save paytonrules/c00a7fb6c813aefc29375c7ac050bdf8 to your computer and use it in GitHub Desktop.
let lookupImageKey = function
| EntityType.Laser _ -> Laser
| EntityType.Bullet _ -> Bullet
| _ -> LargeInvaderOpen
let lookupImage imageKey = Map.tryFind imageKey lookupTable
let positionImage image entity =
match entity with
| EntityType.Laser e -> {Image = image;
Position = {X = e.Entity.Position.X;
Y = e.Entity.Position.Y}}
| EntityType.Bullet e -> {Image = image;
Position = {X = e.Entity.Position.X;
Y = e.Entity.Position.Y}}
| _ -> {Image = image; Position = {X = 0.; Y = 0.}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment