/**
   * Calculates cannon bitmap rotation
   *
   * @param touch_x x coordinates of the touch event
   * @param touch_y y coordinates of ther touch event
   * @param cannon cannon object
   * @return new rotation value
   */
  public static float CannonRotationByTouch(int touch_x, int touch_y, Cannon cannon) {
    float result = cannon.GetRotation();

    if (CheckIfTouchIsInTheZone(touch_x, touch_y, cannon)) {
      if (CheckIsOnLeftSideScreen(touch_x)) {
        int Opposite = touch_x - cannon.GetX();
        int Adjacent = cannon.GetY() - touch_y;

        double angle = Math.atan2(Opposite, Adjacent);
        result = (float) Math.toDegrees(angle);
      } else {
        int Opposite = cannon.GetX() - touch_x;
        int Adjacent = cannon.GetY() - touch_y;

        double angle = Math.atan2(Opposite, Adjacent);
        result = ANGLE_360 - (float) Math.toDegrees(angle);
      }
    }

    return result;
  }