Files
Renan 23f13c395a Improvement(#419): Rename animation to sprite animation (#429)
* rename animation stuff

* rename sprite animation component

* pr stuff
2020-08-06 01:21:20 +01:00

32 lines
836 B
Dart

import 'package:flame/flame.dart';
import 'package:flame/game.dart';
import 'package:flame/sprite_animation.dart';
import 'package:flame/components/sprite_animation_component.dart';
import 'package:flutter/material.dart';
void main() async {
WidgetsFlutterBinding.ensureInitialized();
final Size size = await Flame.util.initialDimensions();
runApp(MyGame(size).widget);
}
class MyGame extends BaseGame {
MyGame(Size screenSize) {
size = screenSize;
_start();
}
void _start() async {
final animation = await SpriteAnimation.fromAsepriteData(
'chopper.png',
'chopper.json',
);
final animationComponent = SpriteAnimationComponent(200, 200, animation);
animationComponent.x = (size.width / 2) - 100;
animationComponent.y = (size.height / 2) - 100;
add(animationComponent);
}
}