Files
flame/examples/lib/commons/ember.dart
Erick b3efb612cb feat: ComponentKey API (#2566)
Adds a new key api on FCS, which will allow users to get a component from the tree, without needing to iterate over all the children or a parent descendants.
2023-06-20 09:36:15 -03:00

26 lines
650 B
Dart

import 'package:flame/components.dart';
import 'package:flame/game.dart';
import 'package:meta/meta.dart';
class Ember<T extends FlameGame> extends SpriteAnimationComponent
with HasGameRef<T> {
Ember({super.position, Vector2? size, super.priority, super.key})
: super(
size: size ?? Vector2.all(50),
anchor: Anchor.center,
);
@mustCallSuper
@override
Future<void> onLoad() async {
animation = await gameRef.loadSpriteAnimation(
'animations/ember.png',
SpriteAnimationData.sequenced(
amount: 3,
textureSize: Vector2.all(16),
stepTime: 0.15,
),
);
}
}