FlyingAttackObject constructor
FlyingAttackObject({
- required Vector2 position,
- required Future<
SpriteAnimation> flyAnimation, - required Direction direction,
- required double width,
- required double height,
- dynamic id,
- Future<
SpriteAnimation> ? destroyAnimation, - double speed = 150,
- double damage = 1,
- AttackFromEnum attackFrom = AttackFromEnum.ENEMY,
- bool withDecorationCollision = true,
- VoidCallback? onDestroyedObject,
- bool enableDiagonal = true,
- LightingConfig? lightingConfig,
- CollisionConfig? collision,
Implementation
FlyingAttackObject({
required Vector2 position,
required Future<SpriteAnimation> flyAnimation,
required this.direction,
required this.width,
required this.height,
this.id,
this.destroyAnimation,
this.speed = 150,
this.damage = 1,
this.attackFrom = AttackFromEnum.ENEMY,
this.withDecorationCollision = true,
this.onDestroyedObject,
this.enableDiagonal = true,
LightingConfig? lightingConfig,
CollisionConfig? collision,
}) {
_loader.add(AssetToLoad(flyAnimation, (value) {
return this.flyAnimation = value;
}));
this.position = Vector2Rect(
position,
Vector2(width, height),
);
if (lightingConfig != null) setupLighting(lightingConfig);
setupCollision(
collision ??
CollisionConfig(
collisions: [
CollisionArea.rectangle(
size: Size(width, height),
),
],
),
);
}