Beispiel #1
0
 public void update(long elapsedTime) {
   if (visible && timer.action(elapsedTime)) {
     this.tmp_img = GraphicsUtils.createImage(width, height, true);
     this.graphics2D = tmp_img.createGraphics();
     for (int i = 0; i < max; i++) {
       if (maxs[i] == flag || maxs[i] == -flag) {
         bools[i] = !bools[i];
       }
       maxs[i] += bools[i] ? 1 : -1;
       if (d[i] == 0
           && (matching == i
               || matching < 0
                   && abs(randx - xs[i] - sakura_width / 2) < sakura_width / 2
                   && abs(randy - ys[i] - sakura_height / 2) < sakura_height / 2)) {
         xs[i] = randx - sakura_width / 2;
         ys[i] = randy - sakura_height / 2;
         maxs[i] = 0;
         matching = i;
       } else {
         xs[i] += maxs[i];
         if (ys[i] < height) {
           ys[i] += s[i];
         } else {
           xs[i] = (int) (LSystem.random.nextFloat() * (width - 1));
           ys[i] = -(int) (LSystem.random.nextFloat() * 1) - images[d[i]].getHeight(null);
         }
       }
       this.tmp_x = xs[i];
       this.tmp_y = ys[i];
       graphics2D.drawImage(images[d[i]], tmp_x, tmp_y, null);
     }
   }
 }
Beispiel #2
0
 public void setDelay(long delay) {
   timer.setDelay(delay);
 }