simpleAttackMelee method

void simpleAttackMelee({
  1. required Future<SpriteAnimation> animationRight,
  2. required double damage,
  3. required Vector2 size,
  4. int? id,
  5. bool withPush = true,
  6. double? radAngleDirection,
  7. VoidCallback? execute,
  8. int interval = 1000,
  9. double marginFromCenter = 16,
  10. Vector2? centerOffset,
})

Execute simple attack melee using animation

Implementation

void simpleAttackMelee({
  required Future<SpriteAnimation> animationRight,
  required double damage,
  required Vector2 size,
  int? id,
  bool withPush = true,
  double? radAngleDirection,
  VoidCallback? execute,
  int interval = 1000,
  double marginFromCenter = 16,
  Vector2? centerOffset,
}) {
  if (!checkInterval('attackMelee', interval, dtUpdate)) return;

  if (isDead) return;

  simpleAttackMeleeByAngle(
    id: id,
    withPush: withPush,
    centerOffset: centerOffset,
    marginFromCenter: marginFromCenter,
    damage: damage,
    size: size,
    angle: angle,
    animation: animationRight,
    attackFrom: AttackOriginEnum.ENEMY,
  );

  execute?.call();
}