Beispiel #1
0
  @Override
  public void actionPerformed(ActionEvent e) {
    // TODO Auto-generated method stub

    width = frame.getWidth();
    height = frame.getHeight();
    sizeControl.width = width;
    sizeControl.height = height;

    if (info.pressed == true && !showGuide) {
      showGuide = true;
    }

    if (back.pressed == true && showGuide) {
      showGuide = false;
    }

    go.x = width / 2;
    go.y = height / 2;
    info.x = width / 2;
    info.y = height / 2 + 150;
    back.x = 3 * width / 4;
    back.y = height / 2 + 150;

    for (int i = 0; i < boomList.size(); i++) {
      boomList.get(i).updatePosition();
      if (Integer.parseInt(boomList.get(i).toString()) <= 0) {
        boomList.remove(i);
      } else {
        for (int ii = 0; ii < gravList.size(); ii++) {
          gravList.get(ii).pull(boomList.get(i));
          if (boomList.get(i).collide(gravList.get(ii))) {
            boomList.remove(i);
          }
        }
      }
    }

    count--;
    if (count <= 0) {

      double rand1 = Math.random();
      double rand2 = Math.random();
      for (int ii = 0; ii < num; ii++) {
        boomList.add(new boom(rand1 * width, rand2 * height));
      }
      count = delay;
    }

    repaint();
  }