This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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