attack method

void attack()

Implementation

void attack() {
  _attackTimer = _attackDuration;
  final callback = onAttack;
  if (callback != null) {
    callback();
  } else {
    game.spawnSparkleBurst(
      position + Vector2(math.cos(angle) * 20, math.sin(angle) * 20),
      count: 4,
    );
  }
  game.eventBus?.emit(const PlayerAttackedEvent());
}