Beispiel #1
0
  public void update() {
    // Removes the particles if they their lifespan is over in the level
    time++;
    if (time > 9000) time = 0;
    if (time > life) remove();
    za -= 0.1;

    // Bouncing
    if (zz < 0) {
      zz = 0;
      za *= -0.55;
      xa *= 0.4;
      ya *= 0.4;
    }

    // xx is our x but in a double value so we sum xa to simulate some physics, the same goes with
    // yy but we also
    // sum zz and za to simulate bouncing and gravity
    move(xx + xa, yy + ya + zz + za);
  }