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