Back to Flame

README

packages/flame_kenney_xml/README.md

1.37.01.5 KB
Original Source
<!-- markdownlint-disable MD013 --> <p align="center"> <a href="https://flame-engine.org"> </a> </p> <p align="center"> Adds support for parsing XML sprite sheets from https://kenney.nl, and other sprite sheets on the same format. </p> <p align="center"> <a title="Pub" href="https://pub.dev/packages/flame_kenney_xml" ></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 -->

Getting started

To get started, first add flame_kenney_xml as a dependency in your flutter project.

bash
flutter pub add flame_kenney_xml

Then place the spritesheet.json in assets/ and spritesheet.png in assets/images/ (or whatever the names of the files are).

Then load the image and the spritesheet using:

dart
final spritesheet = await XmlSpriteSheet.load(
  image: 'spritesheet.png',
  xml: 'spritesheet.xml`,
);