Advertisement
Guest User

Untitled

a guest
Apr 19th, 2014
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
F# 0.86 KB | None | 0 0
  1. module PlatformerActor
  2.  
  3. open Microsoft.Xna.Framework
  4. open Microsoft.Xna.Framework.Graphics
  5. open Microsoft.Xna.Framework.Content
  6.  
  7. type BodyType =
  8.     | Static
  9.     | Dynamic of Vector2
  10.  
  11. type PlayerState =
  12.     | Nothing
  13.     | Jumping
  14.  
  15. type ActorType =
  16.     | Player of PlayerState
  17.     | Obstacle
  18.  
  19. type WorldActor =
  20.     {
  21.         ActorType : ActorType;
  22.         Position : Vector2;
  23.         Size : Vector2;
  24.         Texture : Texture2D option;
  25.         BodyType : BodyType
  26.     }
  27.     member this.CurrentBounds
  28.         with get () = Rectangle((int this.Position.X),(int this.Position.Y),(int this.Size.X),(int this.Size.Y))
  29.  
  30.     member this.DesiredBounds
  31.         with get () = let desiredPos = match this.BodyType with
  32.                                        | Dynamic(s) -> this.Position + s
  33.                                        | _-> this.Position
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement