flame_gdx_texture_packer 0.6.2

This package is no longer maintained. Please use the official package flame_texturepacker maintained by the Flame team. You can find it here: https://pub.dev/packages/flame_texturepacker.

Flame GDX Texture Packer

This package is no longer maintained.

Please use the official package flame_texturepacker maintained by the Flame team.


A flame plugin to import sprite sheets generated by Gdx Texture Packer and Code and Web Texture Packer

Pack all the sprites in a single atlas file

Try the example on Flutter Web

Usage

Add the generated atlas file and sprite sheet images into the assets/ and link the files in your pubspec.yaml file:

 assets:
    - assets/atlasMap.atlas
    - assets/atlasMap.png

Import the plugin like this:

import 'package:flame_gdx_texture_packer/flame_gdx_texture_packer.dart';

Load the TextureAtlas passing the path of the sprite sheet atlas file:

final atlas = await fromAtlas('atlasMap.atlas');

Get a list of sprites ordered by their index, you can use the list to generate an animation:

final spriteList = atlas.findSpritesByName('robot_walk');

final animation = SpriteAnimation.spriteList(
 spriteList,
 stepTime: 0.1,
 loop: true,
);

Get individual sprites by name:

final jumpSprite = atlas.findSpriteByName('robot_jump')!;
final fallSprite = atlas.findSpriteByName('robot_fall')!;
final idleSprite = atlas.findSpriteByName('robot_idle')!;

Supported Features

FeatureSupported
Allow RotationYES
Multiple PagesYES
Use indicesYES
Strip whitespace XNO
Strip whitespace YNO

Example

Full working example can be found in example folder.

Note: Sprites used in this example can be found OpenGameArt here.