moveUpLeft method

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

Move player to Up and Left

Implementation

bool moveUpLeft(
  double speedX,
  double speedY,
) {
  bool successLeft = moveLeft(
    speedX * REDUCTION_SPEED_DIAGONAL,
    notifyOnMove: false,
  );
  bool successUp = moveUp(
    speedY * REDUCTION_SPEED_DIAGONAL,
    notifyOnMove: false,
  );
  if (successLeft && successUp) {
    lastDirection = Direction.upLeft;
  }

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