moveDownLeft method

bool moveDownLeft(
  1. double speedX,
  2. double speedY
)

Move player to Down and Left

Implementation

bool moveDownLeft(double speedX, double speedY) {
  bool successLeft = moveLeft(
    speedX * REDUCTION_SPEED_DIAGONAL,
    notifyOnMove: false,
  );
  bool successDown = moveDown(
    speedY * REDUCTION_SPEED_DIAGONAL,
    notifyOnMove: false,
  );

  if (successLeft && successDown) {
    lastDirection = Direction.downLeft;
  }

  if (successLeft | successDown) {
    onMove(
      speed,
      lastDirection,
      BonfireUtil.getAngleFromDirection(lastDirection),
    );
    return true;
  } else {
    onMove(
      0,
      Direction.downLeft,
      BonfireUtil.getAngleFromDirection(Direction.downLeft),
    );
    return false;
  }
}