Files
2019-03-23 15:02:17 -03:00

33 lines
974 B
Dart

import 'package:flame/flame.dart';
import 'package:flame/game.dart';
import 'package:flame/animation.dart' as flame_animation;
import 'package:flame/components/animation_component.dart';
import 'package:flutter/material.dart';
void main() => runApp(MyGame().widget);
class MyGame extends BaseGame {
MyGame() {
_start();
}
void _start() async {
final Size size = await Flame.util.initialDimensions();
final animation = flame_animation.Animation.sequenced('chopper.png', 4,
textureWidth: 48, textureHeight: 48, stepTime: 0.15);
final animationComponent = AnimationComponent(100, 100, animation);
animationComponent.x = size.width / 2 - 100;
animationComponent.y = 100;
final reversedAnimationComponent =
AnimationComponent(100, 100, animation.reversed());
reversedAnimationComponent.x = size.width / 2;
reversedAnimationComponent.y = 100;
add(animationComponent);
add(reversedAnimationComponent);
}
}