Exemplo n.º 1
0
 private void getVelocity() {
   vy = 3.0;
   vx = rgen.nextDouble(1.0, 3.0);
   if (rgen.nextBoolean(0.5)) {
     vx = -vx;
   }
 }
Exemplo n.º 2
0
 /** When mouse pressed: begin our fantastic game */
 public void mousePressed(MouseEvent e) {
   if (vx == 0) {
     vx = rgen.nextDouble(0.5, 1);
     vy = -1;
     if (rgen.nextBoolean() == true) {
       vx *= -1;
     }
   }
 }