Beispiel #1
0
        public void Draw(GameTime gameTime, SpriteBatch spriteBatch, IntTwo position, float layer)
        {
            if (animations[animationIndex].Tiles.Count < animationFrame + 1)
                animationFrame = 0;

            var test = animations[animationIndex].Tiles[animationFrame];
            spriteBatch.Draw(tilesheet, new Rectangle(position.X, position.Y, (int)(tileWidth * Game1.GameScale), (int)(tileHeight * Game1.GameScale)), new Rectangle(test.X * tileWidth, test.Y * tileHeight, tileWidth, tileHeight), Color.White, 0f, new Vector2(tileWidth / 2f, tileHeight / 2f), SpriteEffects.None, layer);
        }
Beispiel #2
0
 public Animator(Texture2D tilesheet, IntTwo dimensions)
 {
     this.tilesheet = tilesheet;
     tileWidth = dimensions.X;
     tileHeight = dimensions.Y;
 }