FlyingAttackObject constructor
FlyingAttackObject({
- required Vector2 position,
- required Vector2 size,
- required Future<
SpriteAnimation> flyAnimation, - Direction? direction,
- double angle = 0,
- dynamic id,
- Future<
SpriteAnimation> ? animationDestroy, - Vector2? destroySize,
- double speed = 150,
- double damage = 1,
- AttackFromEnum attackFrom = AttackFromEnum.ENEMY,
- bool withDecorationCollision = true,
- VoidCallback? onDestroy,
- bool enabledDiagonal = true,
- LightingConfig? lightingConfig,
- CollisionConfig? collision,
Implementation
FlyingAttackObject({
required Vector2 position,
required Vector2 size,
required Future<SpriteAnimation> flyAnimation,
this.direction,
double angle = 0,
this.id,
this.animationDestroy,
this.destroySize,
double speed = 150,
this.damage = 1,
this.attackFrom = AttackFromEnum.ENEMY,
this.withDecorationCollision = true,
this.onDestroy,
this.enabledDiagonal = true,
LightingConfig? lightingConfig,
CollisionConfig? collision,
}) {
this.speed = speed;
loader?.add(AssetToLoad(flyAnimation, (value) {
animation = value;
}));
this.position = position;
this.size = size;
this.angle = angle;
_cosAngle = cos(angle);
_senAngle = sin(angle);
if (lightingConfig != null) setupLighting(lightingConfig);
setupCollision(
collision ??
CollisionConfig(
collisions: [
CollisionArea.rectangle(
size: Vector2(width, height),
),
],
),
);
}