Skip to content

Instantly share code, notes, and snippets.

@IntegerMan
Created October 6, 2019 03:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save IntegerMan/adbd9ec2e570f8824e79a52896e61c4b to your computer and use it in GitHub Desktop.
Save IntegerMan/adbd9ec2e570f8824e79a52896e61c4b to your computer and use it in GitHub Desktop.
let moveActor world actor xDiff yDiff =
let pos = newPos (actor.Pos.X + xDiff) (actor.Pos.Y + yDiff)
if (isValidPos pos world) && not (hasObstacle pos world) then
let actor = { actor with Pos = pos }
match actor.ActorKind with
| Squirrel _ -> { world with Squirrel = actor }
| Tree -> { world with Tree = actor }
| Acorn -> { world with Acorn = actor }
| Rabbit -> { world with Rabbit = actor }
| Doggo -> { world with Doggo = actor }
else
world
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment