AnimatedGameObject constructor

AnimatedGameObject({
  1. required Vector2 position,
  2. required Vector2 size,
  3. FutureOr<SpriteAnimation>? animation,
  4. VoidCallback? onFinish,
  5. VoidCallback? onStart,
  6. bool removeOnFinish = true,
  7. double angle = 0,
  8. LightingConfig? lightingConfig,
  9. Anchor anchor = Anchor.topLeft,
  10. bool loop = true,
  11. int? objectPriority,
  12. bool renderAboveComponents = false,
})

Implementation

AnimatedGameObject({
  required super.position,
  required super.size,
  FutureOr<SpriteAnimation>? animation,
  this.onFinish,
  this.onStart,
  this.removeOnFinish = true,
  super.angle = 0,
  super.lightingConfig,
  super.anchor = Anchor.topLeft,
  bool loop = true,
  super.objectPriority,
  super.renderAboveComponents,
}) : super(sprite: null) {
  loader?.add(AssetToLoad(
    animation,
    (value) {
      setAnimation(
        value,
        size: size,
        onFinish: _onFinish,
        onStart: onStart,
        loop: loop,
      );
    },
  ));
}