Monogame Sprite Sheet -
this.spriteSheet = spriteSheet; this.spriteFrames = spriteFrames; this.frameRate = frameRate; this.currentFrame = 0;
// Parameters: X, Y, Width, Height Rectangle sourceRect = new Rectangle(128, 0, 64, 64); _spriteBatch.Begin(); _spriteBatch.Draw(spriteSheet, new Vector2(100, 100), sourceRect, Color.White); _spriteBatch.End(); Use code with caution. Step 4: Creating a Basic Animation System monogame sprite sheet
_timeElapsed += (float)gameTime.ElapsedGameTime.TotalSeconds; this.spriteSheet = spriteSheet
If you are moving from drawing static rectangles to bringing your game to life in MonoGame, the sprite sheet is your most essential tool. While it is possible to load every frame of animation as a separate .png file, doing so is a performance nightmare and a logistical headache. this.spriteFrames = spriteFrames