SHARE
TWEET

Untitled

a guest May 19th, 2017 47 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /// <summary>
  2. /// A rectangle telling us where to pull from the source texture when rendering.
  3. /// </summary>
  4. internal Rectangle currentFrameRect
  5. {
  6.  get
  7.  {
  8.      Vector2 rSize = new Vector2(texture.Width / Animation.sheetMatrix.X, texture.Height / Animation.sheetMatrix.Y);
  9.      Vector2 rPos = new Vector2(0, 0);
  10.      int cFrame = Animation.currentFrame;
  11.  
  12.      while (cFrame > Animation.sheetMatrix.X)
  13.      {
  14.          cFrame -= (int)Animation.sheetMatrix.X;
  15.          rPos.Y++;
  16.      }
  17.      rPos.X = Math.Max((cFrame - 1), 0);
  18.  
  19.      return new Rectangle((int)(rPos.X * rSize.X), (int)(rPos.Y * rSize.Y), (int)(rSize.X), (int)(rSize.Y));
  20.  }
  21. }
RAW Paste Data
Top