FlatRedBall.AnimationChain.MonoGame
0.4.0-preview.1
See the version list below for details.
dotnet add package FlatRedBall.AnimationChain.MonoGame --version 0.4.0-preview.1
NuGet\Install-Package FlatRedBall.AnimationChain.MonoGame -Version 0.4.0-preview.1
<PackageReference Include="FlatRedBall.AnimationChain.MonoGame" Version="0.4.0-preview.1" />
<PackageVersion Include="FlatRedBall.AnimationChain.MonoGame" Version="0.4.0-preview.1" />
<PackageReference Include="FlatRedBall.AnimationChain.MonoGame" />
paket add FlatRedBall.AnimationChain.MonoGame --version 0.4.0-preview.1
#r "nuget: FlatRedBall.AnimationChain.MonoGame, 0.4.0-preview.1"
#:package FlatRedBall.AnimationChain.MonoGame@0.4.0-preview.1
#addin nuget:?package=FlatRedBall.AnimationChain.MonoGame&version=0.4.0-preview.1&prerelease
#tool nuget:?package=FlatRedBall.AnimationChain.MonoGame&version=0.4.0-preview.1&prerelease
FlatRedBall.AnimationChain
A standalone library for loading and playing .achx (XML) or .achj (JSON) sprite animation
files created by the FlatRedBall Animation Editor —
AchxLoader picks the dialect from the file extension automatically.
No FlatRedBall2 engine dependency required — drop it into any MonoGame or KNI project.
Choose a variant
| Target platform | Package |
|---|---|
| MonoGame DesktopGL | FlatRedBall.AnimationChain.MonoGame |
| KNI / Blazor WASM | FlatRedBall.AnimationChain.KNI |
dotnet add package FlatRedBall.AnimationChain.MonoGame
# or
dotnet add package FlatRedBall.AnimationChain.KNI
Quick start
// LoadContent
_loader = new AchxLoader(GraphicsDevice);
_animations = _loader.Load("Content/player.achx");
_player = new AnimationPlayer(_animations);
_player.Play("Run");
// Update
_player.Update(gameTime.ElapsedGameTime);
// Draw
spriteBatch.DrawAnimation(_player, position, Color.White);
// UnloadContent / Dispose
_loader.Dispose();
Copy the .achx and its PNGs next to each other (CopyToOutputDirectory).
AchxLoader loads them with Texture2D.FromStream, not the MGCB pipeline.
Drawing
DrawAnimation uses MonoGame SpriteBatch conventions:
positionis the top-left of the current frame's source rectangle (before per-frame offset), in screen pixels. Y increases downward.scalemultiplies the source rectangle. A 16×32 frame atscale: 3is 48×96 on screen.AnimationFrame.RelativeX/RelativeYare unscaled source pixels from the.achx.DrawAnimationapplies them asoffset * scale. PositiveRelativeYmoves the sprite down.- If the
.achxwas authored in a Y-up world, negateRelativeYor flip Y in your camera transform.
To stand a character on a ground point (x, y) (feet on y):
var frame = player.CurrentFrame;
int srcW = frame?.SourceRectangle?.Width ?? 0;
int srcH = frame?.SourceRectangle?.Height ?? 0;
float width = srcW * scale;
float height = srcH * scale;
spriteBatch.DrawAnimation(
player,
new Vector2(x - width / 2f, y - height),
Color.White,
scale: scale);
Empty pixels at the bottom of a cell still count in SourceRectangle.Height.
If idle-up/down hover while left/right look planted, set RelativeY on those
frames in the Animation Editor (or crop the source rect) so the shoes sit on
the last row of the cell.
Use SamplerState.PointClamp for pixel art.
Playback notes
Play(name)is a no-op if that chain is already playing, so it is safe every frame. Unknown names are ignored and the current animation continues.- One
AchxLoaderowns and caches textures. ManyAnimationPlayers can share oneAnimationChainList. DrawAnimationapplies authored multiply color, alpha, andColorOperation.Add(Add ends and restarts theSpriteBatch— see the method remarks). Per-frame shapes are data only.FlipDiagonalis authored and not applied (SpriteEffectshas no diagonal option).- This package is not the FlatRedBall2 engine player.
Sprite.PlayAnimationuses a different origin and Y axis — do not mix the two type systems.
Web / Blazor WASM (KNI)
The filesystem is unavailable in browser environments. Pre-fetch bytes and pass streams instead:
var achxBytes = await httpClient.GetByteArrayAsync("Content/player.achx");
var texBytes = await httpClient.GetByteArrayAsync("Content/player.png");
_animations = _loader.Load(
new MemoryStream(achxBytes),
texPath => new MemoryStream(texBytes));
Key types
AchxLoader— loads.achxfiles from disk or a stream; caches textures by path;IDisposable.AnimationPlayer— drives playback. CallPlay(name),Update(elapsed), readCurrentFrame.SpriteBatchExtensions—spriteBatch.DrawAnimation(player, position, color)extension method.
License
MIT — see LICENSE.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net8.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 0.5.1-preview.1 | 48 | 8/19/2026 |
| 0.5.0-preview.1 | 47 | 8/19/2026 |
| 0.4.0-preview.1 | 52 | 8/19/2026 |
| 0.3.1-preview.1 | 80 | 5/30/2026 |