Esempio n. 1
0
  public void collision() {

    for (int i = 0; i < handler.object.size(); i++) {
      GameObject tempObject = handler.object.get(i);
      if (tempObject.getId() == ID.E_BASIC1
          || tempObject.getId() == ID.E_FAST3
          || tempObject.getId() == ID.E_FAST1
          || tempObject.getId() == ID.E_FAST2
          || tempObject.getId() == ID.E_HOAMING1
          || tempObject.getId() == ID.E_S_BOSS_BULLET
          || tempObject.getId() == ID.E_BASICH) {

        if (getBounds().intersects(tempObject.getBounds())) {
          handler.removeObject(tempObject);
        }
      }
    }
  }
Esempio n. 2
0
  private void initObjects() {

    if (handler.objects.size() > 0) {
      handler.removeObject(handler.objects.get(0));
    }
    handler.addObject(
        new ShipV(
            WIDTH / 2,
            10,
            randomgen1.nextDouble() * 2 - 1,
            0,
            0,
            270,
            randomgen1.nextDouble() * 5,
            0,
            0,
            1));
    ;
    landingZone1 =
        new LandingZone(
            WIDTH / 2 + randomgen1.nextInt(WIDTH / 2) - WIDTH / 4,
            HEIGHT - randomgen1.nextInt(HEIGHT - 100),
            20);
  }
Esempio n. 3
0
 public void tick(LinkedList<GameObject> object) {
   if (alpha > life) {
     alpha -= (life - 0.0001f);
   } else handler.removeObject(this);
 }