|
@ -16,13 +16,18 @@ Random random; |
|
|
int randomXDirection = random.nextInt(2); |
|
|
int randomXDirection = random.nextInt(2); |
|
|
if (randomXDirection == 0) |
|
|
if (randomXDirection == 0) |
|
|
randomXDirection--; |
|
|
randomXDirection--; |
|
|
setXDirection(randomXDirection * ballSpeed); |
|
|
|
|
|
|
|
|
xDirect(randomXDirection); |
|
|
|
|
|
|
|
|
int randomYDirection = random.nextInt(2); |
|
|
int randomYDirection = random.nextInt(2); |
|
|
if (randomYDirection == 0) |
|
|
if (randomYDirection == 0) |
|
|
randomYDirection--; |
|
|
randomYDirection--; |
|
|
setYDirection(randomYDirection * ballSpeed); |
|
|
setYDirection(randomYDirection * ballSpeed); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void xDirect(int randomXDirection) { |
|
|
|
|
|
setXDirection(randomXDirection * ballSpeed); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
public void setXDirection (int randomXDirection){ |
|
|
public void setXDirection (int randomXDirection){ |
|
|
xVelocity = randomXDirection; |
|
|
xVelocity = randomXDirection; |
|
|
} |
|
|
} |
|
|