A flame plugin to import spritesheets generated by TexturePacker

Install from Dart Pub

Include the following to your pubspec.yaml file:

  flame_texturepacker: any


Drop generated spritesheet image into the assets/images/ folder and the spritesheet json into assets/ and link the files in your pubspec.yaml file:

   - assets/spritesheet.json
   - assets/images/spritesheet.png

Import the plugin like this: import 'package:flame_texturepacker/flame_texturepacker.dart';

Generate a list of Sprites from the provided spritesheet:

List<Sprite> sprites = await TexturepackerLoader.fromJSONAtlas('spritesheet.png', 'spritesheet.json');

The list can be used to generate an Animation as well:

Animation anim = Animation.spriteList(
    stepTime: 0.1,
    loop: true,

Generate a map of Sprites from the provided spritesheet where the key will be the Sprite filename without extension:

Map<String, Sprite> map = await TexturepackerLoader.fromJSONAtlasAsMap('spritesheet.png', 'spritesheet.json');

Full working example can be found in example folder.