FlyingAttackGameObject.byAngle constructor

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

Implementation

FlyingAttackGameObject.byAngle({
  required super.position,
  required super.size,
  required super.animation,
  required super.angle,
  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,
}) : direction = null {
  this.speed = speed;

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

  moveFromAngle(angle);
  movementOnlyVisible = false;
}