mirror of
https://github.com/flame-engine/flame.git
synced 2025-11-03 04:18:25 +08:00
28 lines
701 B
Dart
28 lines
701 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({Vector2? position, Vector2? size, int? priority})
|
|
: super(
|
|
position: position,
|
|
size: size ?? Vector2.all(50),
|
|
priority: priority,
|
|
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,
|
|
),
|
|
);
|
|
}
|
|
}
|