示例#1
0
 private void getVelocity() {
   vy = 3.0;
   vx = rgen.nextDouble(1.0, 3.0);
   if (rgen.nextBoolean(0.5)) {
     vx = -vx;
   }
 }
示例#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;
     }
   }
 }