FlyingAttackGameObject constructor

FlyingAttackGameObject({
  1. required Vector2 position,
  2. required Vector2 size,
  3. required FutureOr<SpriteAnimation>? animation,
  4. double angle = 0,
  5. Direction? direction,
  6. dynamic id,
  7. Future<SpriteAnimation>? animationDestroy,
  8. Vector2? destroySize,
  9. double speed = 150,
  10. double damage = 1,
  11. AttackOriginEnum attackFrom = AttackOriginEnum.ENEMY,
  12. bool withDecorationCollision = true,
  13. VoidCallback? onDestroy,
  14. bool enabledDiagonal = true,
  15. LightingConfig? lightingConfig,
  16. ShapeHitbox? collision,
})

Implementation

FlyingAttackGameObject({
  required super.position,
  required super.size,
  required super.animation,
  super.angle = 0,
  this.direction,
  this.id,
  this.animationDestroy,
  this.destroySize,
  double speed = 150,
  this.damage = 1,
  this.attackFrom = AttackOriginEnum.ENEMY,
  this.withDecorationCollision = true,
  this.onDestroy,
  this.enabledDiagonal = true,
  super.lightingConfig,
  this.collision,
}) {
  this.speed = speed;

  _cosAngle = cos(angle);
  _senAngle = sin(angle);

  if (direction != null) {
    moveFromDirection(direction!, enabledDiagonal: enabledDiagonal);
  } else {
    moveFromAngle(angle);
  }
  movementOnlyVisible = false;
}