Back to Flame

flame_fire_atlas

packages/flame_fire_atlas/README.md

1.37.01.9 KB
Original Source
<!-- markdownlint-disable MD013 --> <p align="center"> <a href="https://flame-engine.org"> </a> </p> <p align="center"> Adds support for <a href="https://github.com/flame-engine/fire-atlas">fire_atlas</a>-based sprite sheets inside <a href="https://github.com/flame-engine/flame">Flame</a>. </p> <p align="center"> <a title="Pub" href="https://pub.dev/packages/flame_fire_atlas" ></a> <a title="Test" href="https://github.com/flame-engine/flame/actions?query=workflow%3Acicd+branch%3Amain"></a> <a title="Discord" href="https://discord.gg/pxrBmy4"></a> <a title="Melos" href="https://github.com/invertase/melos"></a> </p>
<!-- markdownlint-enable MD013 --> <!-- markdownlint-disable-next-line MD002 -->

flame_fire_atlas

Flame Fire Atlas is a texture atlas lib for Flame. Atlases can be created using the
<a href="https://github.com/flame-engine/fire-atlas">Fire Atlas Editor</a>.

How to use

Add the flame_fire_atlas dependency on your pubspec.yaml.

Then, load the atlas from your assets:

dart
// file at assets/atlas.fa
final atlas = await FireAtlas.loadAsset('atlas.fa');

or when inside a game instance, the loadFireAtlas can be used:

dart
// file at assets/atlas.fa
final atlas = await loadFireAtlas('atlas.fa');

With the instance loaded you can now get sprites and animations like:

dart
atlas.getAnimation('animation_name');
atlas.getSprite('sprite_name');