moveDown method

bool moveDown(
  1. double speed, {
  2. bool notifyOnMove = true,
})

Move player to Down

Implementation

bool moveDown(double speed, {bool notifyOnMove = true}) {
  double innerSpeed = speed * dtUpdate;
  Vector2 displacement = position.translate(0, innerSpeed);

  if (_isCollision(displacement)) {
    if (notifyOnMove) {
      onMove(
        0,
        Direction.down,
        BonfireUtil.getAngleFromDirection(Direction.down),
      );
    }
    return false;
  }

  isIdle = false;
  position = displacement;
  lastDirection = Direction.down;
  if (notifyOnMove) {
    onMove(
      speed,
      lastDirection,
      BonfireUtil.getAngleFromDirection(lastDirection),
    );
  }
  _requestUpdatePriority();
  return true;
}