From a5e187c4be6a45cbe7b3dd06d25a87c512bafeca Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 22:03:22 +0100 Subject: [PATCH] refactoring: --- src/main/java/PingPong/Ball.java | 7 ++++++- target/classes/PingPong/Ball.class | Bin 968 -> 1504 bytes 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/PingPong/Ball.java b/src/main/java/PingPong/Ball.java index 42d9752..22a7e65 100644 --- a/src/main/java/PingPong/Ball.java +++ b/src/main/java/PingPong/Ball.java @@ -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; } diff --git a/target/classes/PingPong/Ball.class b/target/classes/PingPong/Ball.class index 533736eca023d51258f45a744ebbc5b3d0b8c337..55cdf373e74fa3a532ddcf289cc8a74d0d81e69c 100644 GIT binary patch literal 1504 zcmZ`(?Q+{h6g}(MQtWIT$Eg!qr_hi<9J#5XK>0`;N?lqEP7{)jr}>9s3tON_8CCh{ zf1ZN3fN9bhnBf6Uk zAK4B2IBIM=-N^R)o}*ygb$vHlS1@ZWJ}aF(#*sHs(3pT$nA~#x{#M}k8xL&HQ^@ae z*g0^Vo`PzbC@Pd<+{4KA8r!zt3-$|`L`i~9D~#0=$Qg|*s4!j_Zy}rZ=&?09H>dFi zu9A-LoJ1`@Qpna?E3E=qRW;^uovxFIZb$`*t0S(rG;WA%^0^c3CSEu2#q+kt;<@Kp z>JgFeXuK;5^Cun03%YLfLaa57mDu{?vbC;pQ>^Ml_T18F#4Db7AGb|>pz$F-QYfYw zZU$ZuQhg|SDkV}S^Rb;mKgK5}KGpaPYYNlpvB#l(FmSui6~?J#2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