flame_tiled 1.0.0-releasecandidate.15 copy "flame_tiled: ^1.0.0-releasecandidate.15" to clipboard
flame_tiled: ^1.0.0-releasecandidate.15 copied to clipboard

outdated

Tiled support for the Flame game engine. This uses the tiled package and provides wrappers and components to be used inside Flame.

example/lib/main.dart

import 'package:flame/components.dart';
import 'package:flame/flame.dart';
import 'package:flame/game.dart';
import 'package:flame_tiled/flame_tiled.dart';
import 'package:flutter/widgets.dart' hide Animation, Image;

void main() {
  runApp(GameWidget(game: TiledGame()));
}

class TiledGame extends FlameGame {
  @override
  Future<void> onLoad() async {
    await super.onLoad();
    final tiledMap = await TiledComponent.load('map.tmx', Vector2.all(16));
    add(tiledMap);

    final objGroup = tiledMap.tileMap.getObjectGroupFromLayer('AnimatedCoins');
    final coins = await Flame.images.load('coins.png');
    for (final obj in objGroup.objects) {
      add(
        SpriteAnimationComponent(
          position: Vector2(obj.x, obj.y),
          animation: SpriteAnimation.fromFrameData(
            coins,
            SpriteAnimationData.sequenced(
              amount: 8,
              stepTime: .15,
              textureSize: Vector2.all(20),
            ),
          ),
        ),
      );
    }
  }
}
53
likes
0
pub points
94%
popularity

Publisher

verified publisherflame-engine.org

Tiled support for the Flame game engine. This uses the tiled package and provides wrappers and components to be used inside Flame.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flame, flutter, meta, tiled, xml

More

Packages that depend on flame_tiled