예제 #1
0
  private void rightClick() {
    vecSlider.x = 0;
    vecSlider.y = 0;

    for (int i = 0; i < gravityObjectArray.length; i++) {
      gravityObjectArray[i] = null;
    }
  }
예제 #2
0
 private void leftHold(int x, int y) {
   if (y > 5 && y < 55 && x > 10 && x < screenWidth - 200) { // Within sizeSlider region
     sizeSliderVal = x / sizeSliderMultiplier;
     if (x > screenWidth - 250) {
       sizeSliderVal = (screenWidth - 250) / sizeSliderMultiplier;
     }
   } else if (y < 190
       && x > screenWidth - 190
       && y > 10
       && x < screenWidth - 10) { // Within vecSlider region
     vecSlider.x = x - (screenWidth - 100);
     vecSlider.y = y - 100;
   }
 }
예제 #3
0
  private void createGravityObject(int x, int y) {
    int size = sizeSliderVal + 3;
    float[] color = randomColorArray();

    if (!gravityObjectCollision(x, y, size)) {
      for (int i = 0; i < gravityObjectArray.length - 1; i++) {
        if (gravityObjectArray[i] == null || gravityObjectArray[i].size == 0) {
          System.out.println(
              "Created a gravityObject NR: " + i + " Coords: (" + x + ", " + y + ") size: " + size);
          gravityObjectArray[i] = new GravityObject(x, y, size, color);
          gravityObjectArray[i].xV = vecSlider.x * vecSliderMultiplier;
          gravityObjectArray[i].yV = vecSlider.y * vecSliderMultiplier;
          gravityObjectArray[i].force = vecSlider.getDistance();
          break;
        }
      }
    }
  }