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