flame_fire_atlas 0.0.2

  • Readme
  • Changelog
  • Example
  • Installing
  • 64

Flame fire atlas #

Flame fire atlas is a texture atlas lib for Flame. Atlases can be created using the Fire Atlas Editor.

How to use #

Add the dependency on your pubspec

flame_fire_atlas: ^0.0.2

Load the atlas from your assets

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

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

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

[0.0.2] #

  • Updating Flame version

[0.0.1] #

  • Initial release

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:flame/anchor.dart';
import 'package:flame/game.dart';
import 'package:flame/gestures.dart';
import 'package:flame/components/component.dart';
import 'package:flame/components/animation_component.dart';
import 'package:flame_fire_atlas/flame_fire_atlas.dart';

void main() async {
  try {
    WidgetsFlutterBinding.ensureInitialized();
    final atlas = await FireAtlas.fromAsset('caveace.fa');

    final game = ExampleGame(atlas);
    runApp(game.widget);
  } catch (e) {
    print(e);
  }
}

class ExampleGame extends BaseGame with TapDetector {
  FireAtlas _atlas;

  ExampleGame(this._atlas) {
    add(AnimationComponent(150, 100, _atlas.getAnimation('shooting_ptero'))
      ..y = 50);

    add(AnimationComponent(150, 100, _atlas.getAnimation('bomb_ptero'))
      ..y = 50
      ..x = 200);

    add(
      SpriteComponent.fromSprite(50, 50, _atlas.getSprite('bullet'))..y = 200,
    );

    add(
      SpriteComponent.fromSprite(50, 50, _atlas.getSprite('shield'))
        ..x = 100
        ..y = 200,
    );

    add(
      SpriteComponent.fromSprite(50, 50, _atlas.getSprite('ham'))
        ..x = 200
        ..y = 200,
    );
  }

  @override
  void onTapUp(details) {
    final o = details.localPosition;

    add(AnimationComponent(
      100,
      100,
      _atlas.getAnimation('explosion'),
      destroyOnFinish: true,
    )
      ..anchor = Anchor.center
      ..x = o.dx
      ..y = o.dy);
  }
}

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flame_fire_atlas: ^0.0.2

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flame_fire_atlas/flame_fire_atlas.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
36
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
64
Learn more about scoring.

We analyzed this package on Jul 11, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package does not support Flutter platform android

Because:

  • package:flame_fire_atlas/flame_fire_atlas.dart that imports:
  • package:flame/animation.dart that imports:
  • package:flame/sprite.dart that imports:
  • package:flame/flame.dart that imports:
  • package:flame/flame_audio.dart that imports:
  • package:audioplayers/audio_cache.dart that imports:
  • package:path_provider/path_provider.dart that imports:
  • package:path_provider_linux/path_provider_linux.dart that declares support for platforms: linux

Package does not support Flutter platform ios

Because:

  • package:flame_fire_atlas/flame_fire_atlas.dart that imports:
  • package:flame/animation.dart that imports:
  • package:flame/sprite.dart that imports:
  • package:flame/flame.dart that imports:
  • package:flame/flame_audio.dart that imports:
  • package:audioplayers/audio_cache.dart that imports:
  • package:path_provider/path_provider.dart that imports:
  • package:path_provider_linux/path_provider_linux.dart that declares support for platforms: linux

Package does not support Flutter platform linux

Because:

  • package:flame_fire_atlas/flame_fire_atlas.dart that imports:
  • package:flame/animation.dart that imports:
  • package:flame/sprite.dart that imports:
  • package:flame/flame.dart that imports:
  • package:flame/bgm.dart that imports:
  • package:audioplayers/audioplayers.dart that declares support for platforms: android, ios, macos, web

Package does not support Flutter platform macos

Because:

  • package:flame_fire_atlas/flame_fire_atlas.dart that imports:
  • package:flame/animation.dart that imports:
  • package:flame/sprite.dart that imports:
  • package:flame/flame.dart that imports:
  • package:flame/flame_audio.dart that imports:
  • package:audioplayers/audio_cache.dart that imports:
  • package:path_provider/path_provider.dart that imports:
  • package:path_provider_linux/path_provider_linux.dart that declares support for platforms: linux

Package does not support Flutter platform web

Because:

  • package:flame_fire_atlas/flame_fire_atlas.dart that imports:
  • package:flame/animation.dart that imports:
  • package:flame/sprite.dart that imports:
  • package:flame/flame.dart that imports:
  • package:flame/flame_audio.dart that imports:
  • package:audioplayers/audio_cache.dart that imports:
  • package:path_provider/path_provider.dart that declares support for platforms: android, ios, linux, macos

Package does not support Flutter platform windows

Because:

  • package:flame_fire_atlas/flame_fire_atlas.dart that imports:
  • package:flame/animation.dart that imports:
  • package:flame/sprite.dart that imports:
  • package:flame/flame.dart that imports:
  • package:flame/bgm.dart that imports:
  • package:audioplayers/audioplayers.dart that declares support for platforms: android, ios, macos, web

Package not compatible with SDK dart

Because:

  • flame_fire_atlas that is a package requiring null.

Health issues and suggestions

Document public APIs. (-0.36 points)

45 out of 46 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Maintenance issues and suggestions

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (flame).

Package is pre-v0.1 release. (-10 points)

While nothing is inherently wrong with versions of 0.0.*, it might mean that the author is still experimenting with the general direction of the API.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.0 <3.0.0
archive ^2.0.13 2.0.13
flame ^0.22.0 0.22.1 0.24.0
flutter 0.0.0
Transitive dependencies
args 1.6.0
audioplayers 0.15.1
box2d_flame 0.4.6
charcode 1.1.3
collection 1.14.12 1.14.13
convert 2.1.1
crypto 2.1.5
file 5.2.1
flare_dart 2.3.4
flare_flutter 2.0.5
flutter_svg 0.17.4 0.18.0
flutter_web_plugins 0.0.0
intl 0.16.1
meta 1.1.8 1.2.2
ordered_set 2.0.0
path 1.7.0
path_drawing 0.4.1
path_parsing 0.1.4
path_provider 1.6.11
path_provider_linux 0.0.1+2
path_provider_macos 0.0.4+3
path_provider_platform_interface 1.0.2
petitparser 3.0.4
platform 2.2.1
plugin_platform_interface 1.0.2
process 3.0.13
sky_engine 0.0.99
synchronized 2.2.0+1
tiled 0.2.1 0.6.0
typed_data 1.1.6 1.2.0
uuid 2.2.0
vector_math 2.0.8 2.1.0-nullsafety
xdg_directories 0.1.0
xml 3.7.0 4.2.0
Dev dependencies
flutter_test