moveDownRight method

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

Move player to Down and Right

Implementation

bool moveDownRight(double speedX, double speedY) {
  bool successRight = moveRight(
    speedX * REDUCTION_SPEED_DIAGONAL,
    notifyOnMove: false,
  );
  bool successDown = moveDown(
    speedY * REDUCTION_SPEED_DIAGONAL,
    notifyOnMove: false,
  );

  if (successRight && successDown) {
    lastDirection = Direction.downRight;
  }

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