Sprite Sheet [top] | Monogame

public void AddClip(string name, string[] regionNames, float framesPerSecond, bool loop = true)

"texture": "characters/hero_sheet", "frameWidth": 32, "frameHeight": 32, "regions": "idle": "x": 0, "y": 0, "width": 32, "height": 32 , "walk1": "x": 32, "y": 0, "width": 32, "height": 32 , "walk2": "x": 64, "y": 0, "width": 32, "height": 32 , "jump": "x": 96, "y": 0, "width": 32, "height": 32 monogame sprite sheet

var texture = content.Load<Texture2D>("player_sheet"); // 128x128 (4 frames of 32x32) _sheet = new SpriteSheet(texture, 32, 32); // Define animations _sheet.AddRegion("idle1", new Rectangle(0, 0, 32, 32)); _sheet.AddRegion("idle2", new Rectangle(32, 0, 32, 32)); _sheet.AddRegion("walk1", new Rectangle(64, 0, 32, 32)); _sheet.AddRegion("walk2", new Rectangle(96, 0, 32, 32)); _animator = new AnimatedSprite(_sheet); _animator.AddClip("idle", new[] "idle1", "idle2" , 4f); _animator.AddClip("walk", new[] "walk1", "walk2" , 8f); _animator.Play("idle"); public void AddClip(string name

public Rectangle GetRegion(string name)

private SpriteSheet _sheet; private Dictionary<string, AnimationClip> _clips; private AnimationClip _currentClip; private int _currentFrame; private double _timePerFrame; private double _elapsedTime; public AnimatedSprite(SpriteSheet sheet) bool loop = true) "texture": "characters/hero_sheet"

Loader:

Add 1-2px transparent padding between sprites to prevent texture bleeding (adjacent pixels bleeding into your sprite due to texture filtering). 5. Complete Example: Player Character public class Player