From 47b1739728ecc19ee06a735729c6fd1091a57e8b Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 21:47:25 +0100 Subject: [PATCH 01/29] update --- .idea/compiler.xml | 1 - src/main/java/MenuPanel.java | 2 + src/main/java/PingPong/Ball.java | 9 +++- target/classes/MenuPanel$AL.class | Bin 720 -> 720 bytes target/classes/MenuPanel$GameFrame.class | Bin 412 -> 412 bytes target/classes/MenuPanel.class | Bin 1417 -> 1417 bytes target/classes/PingPong/Ball.class | Bin 255 -> 409 bytes target/hellsgamers-1.0-SNAPSHOT.jar | Bin 17151 -> 34869 bytes target/maven-archiver/pom.properties | 2 +- .../compile/default-compile/createdFiles.lst | 27 +++++++++--- .../compile/default-compile/inputFiles.lst | 40 ++++++++++-------- 11 files changed, 54 insertions(+), 27 deletions(-) diff --git a/.idea/compiler.xml b/.idea/compiler.xml index 4c0c5b6..2c583f8 100644 --- a/.idea/compiler.xml +++ b/.idea/compiler.xml @@ -6,7 +6,6 @@ - diff --git a/src/main/java/MenuPanel.java b/src/main/java/MenuPanel.java index 098f221..c685056 100644 --- a/src/main/java/MenuPanel.java +++ b/src/main/java/MenuPanel.java @@ -1,5 +1,6 @@ import PingPong.GamePanel; + import javax.swing.*; import java.awt.*; import java.awt.event.KeyAdapter; @@ -38,6 +39,7 @@ public class MenuPanel extends JPanel { new GameFrame(); } + } } diff --git a/src/main/java/PingPong/Ball.java b/src/main/java/PingPong/Ball.java index 9fe0189..489760e 100644 --- a/src/main/java/PingPong/Ball.java +++ b/src/main/java/PingPong/Ball.java @@ -1,4 +1,11 @@ package PingPong; -public class Ball { +import java.awt.*; + +public class Ball extends Rectangle { +int xVelocity; + public void setXDirection (int randomXDirection){ + xVelocity = randomXDirection; + } + } diff --git a/target/classes/MenuPanel$AL.class b/target/classes/MenuPanel$AL.class index bbbd61b07ed8b6073b45334a96304db06de549c8..7046c06524e255d3c96736107b3c3e65fcc906ea 100644 GIT binary patch delta 27 icmcb>dVzI=0u!V1WJRWMPBjKj26YBe2JOj>O#T2|HU+W( delta 27 icmcb>dVzI=0u!UsWJRWMPE`g@1~mpz2F=NhO#T2|0|l)B diff --git a/target/classes/MenuPanel$GameFrame.class b/target/classes/MenuPanel$GameFrame.class index 3799f3125af7cc8cac6519b7eae591124aeacba7..a8279a03a06d3f9f785b7f17a5c72ec4d1b3bd44 100644 GIT binary patch delta 13 UcmbQkJcoHhIwParo=6Pi|wGBP+?k h&L9O;Bh8=$RAs~<%V5VK$Kb~x&k)6+IN6@n3jl;034s6r delta 81 zcmeC=?&RK}#v;nYz{0@GAi%)KAkM(gAOmD6GYC$$W^v*aVPIttW#D2Eo7~1SM^=J? hok0?)Mv6g+L7Kq`sM3x>mcfrfjvE17UzD#wKDybE0%UF*;AqL{SjJ=TsIZQ`HNBMg;fV%ox!cD=n{<^QkOv#neJO zW0Q#@6{WKN`q8cK)xu`~qaJgcg{HZwP*??eBscdkAYnca?<|!P0kYDq)ZF9CUvG4MRpC delta 151 zcmbQq{GZY1)W2Q(7#J9A83ec(m>8JZ8CZB2SQ*$D83eKt%M$f-67$ma{gbj%lS>#G z*laTMGE3|j8JIOR!`K-(7#Vm2GV{^{@_}lc5_57UW_V7#EhWqjGzbJ3fe>gEkmQ^! hz$m891r!7E7#NrtxPc@On9T~LdBLjrfFu(GKLBH{7r+1j diff --git a/target/hellsgamers-1.0-SNAPSHOT.jar b/target/hellsgamers-1.0-SNAPSHOT.jar index 4d7fbd081e2ea176f3ec6b55b03262d76c0ae346..4191a5593f1af9c9aa1d9531a77eb045a3474443 100644 GIT binary patch delta 19267 zcmaI718`;Cx;31R)3I$kJGO1xwv&!`$F^7C*4<66u0>K|%EEXPLk45+Q zn)<(t{?`xe-=naRtE;VUlPrLODi{ zpeL*xBIaXao3Ogb1k6CSs$UHO0U@+)6LroxgRT&S&bdNd%~?OMee<|!&6`<5Eu~{@ zaB2=9Mck3xTCb%%;518Q_fkSOsZgHxYO%zNQ8gS{__f*4w~7fwJ_Xlekjt%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-(G{F9U-hio$5c$qB9U zVAEvg+ZetATK62N5H-wvH73t*g#?2%`{Z5mKr3s2R?4H8l%+HIXs+Vq8TAk=Zyeil zoDryKBRje;+4LtT7KrH}5-KDqew0~1%^9fSBTxfsva&RuT-c_d0L;TEnSdW|y#T}i z|7*-AZ)}qVXY7k@(o8qaC%)_y%2YT0-gMne2706lu5)$M+ diff --git a/target/maven-archiver/pom.properties b/target/maven-archiver/pom.properties index 4df9572..22f93c5 100644 --- a/target/maven-archiver/pom.properties +++ b/target/maven-archiver/pom.properties @@ -1,5 +1,5 @@ #Generated by Maven -#Mon Feb 06 20:43:15 CET 2023 +#Tue Feb 07 11:52:01 CET 2023 groupId=Hellsgamers artifactId=hellsgamers version=1.0-SNAPSHOT diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst index cb38d8f..2f632ce 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/createdFiles.lst @@ -1,22 +1,35 @@ -Snake\TextView.class MenuPanel.class PingPong\Score.class -PingPong\GamePanel.class +BattleShip\BSButton.class Snake\Window.class -Snake\Snake$1.class +Snake\Controller$1.class MenuPanel$GameFrame.class +BattleShip\Ship.class PingPong\Ball.class Snake\TextView$AnchorType.class +BattleShip\AIGridGUI$SetShipsListener.class MenuPanel$AL.class Main.class +Snake\Controller$GameState.class PingPong\Paddle.class -Snake\Apple.class -Snake\Snake.class +Snake\Game.class PingPong\GameFrame.class Snake\Controller.class -Snake\Drawable.class -MenuFrame.class +BattleShip\AIGridGUI$DirectionCompare.class +BattleShip\AIGridGUI.class Snake\Snake$SnakeDirection.class Snake\SnakeView.class Snake\AppleView.class +Snake\Controller$3.class +Snake\TextView.class +BattleShip\BShip.class +PingPong\GamePanel.class +Snake\Controller$MoveAction.class +Snake\Snake$1.class +Snake\Apple.class +Snake\Snake.class +BattleShip\Direction.class +Snake\Drawable.class +Snake\Controller$2.class +MenuFrame.class Snake\GameView.class diff --git a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst index 8dba2b3..39e231f 100644 --- a/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst +++ b/target/maven-status/maven-compiler-plugin/compile/default-compile/inputFiles.lst @@ -1,17 +1,23 @@ -C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\MenuPanel.java -C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\PingPong\Paddle.java -C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\PingPong\Ball.java -C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\AppleView.java -C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\Controller.java -C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\PingPong\GamePanel.java -C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\Snake.java -C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\MenuFrame.java -C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\Apple.java -C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\Window.java -C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Main.java -C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\SnakeView.java -C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\TextView.java -C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\PingPong\Score.java -C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\GameView.java -C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\PingPong\GameFrame.java -C:\Users\senni\IdeaProjects\hellsgamers\src\main\java\Snake\Drawable.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\MenuPanel.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\BattleShip\AIGridGUI.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\Snake\AppleView.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\PingPong\Paddle.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\MenuFrame.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\BattleShip\Direction.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\Snake\Controller.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\BattleShip\BShip.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\PingPong\GamePanel.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\Main.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\PingPong\Score.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\Snake\Snake.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\Snake\GameView.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\Snake\Drawable.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\BattleShip\BSButton.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\Snake\SnakeView.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\Snake\Apple.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\Snake\Game.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\Snake\TextView.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\BattleShip\Ship.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\PingPong\GameFrame.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\Snake\Window.java +C:\Users\Laura\IdeaProjects\hellsgamers\src\main\java\PingPong\Ball.java From 229a5e725f3f36a3d1223669432928520f160597 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 21:48:21 +0100 Subject: [PATCH 02/29] update --- src/main/java/PingPong/Ball.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/PingPong/Ball.java b/src/main/java/PingPong/Ball.java index 489760e..8c17da9 100644 --- a/src/main/java/PingPong/Ball.java +++ b/src/main/java/PingPong/Ball.java @@ -4,8 +4,12 @@ import java.awt.*; public class Ball extends Rectangle { int xVelocity; +int yVelocity; public void setXDirection (int randomXDirection){ xVelocity = randomXDirection; } + public void setYDirection (int randomYDirection){ + yVelocity = randomYDirection; + } } From c0e35d950b163f5df329ccce2dda7786207c39a9 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 21:54:08 +0100 Subject: [PATCH 03/29] update --- src/main/java/PingPong/Ball.java | 18 ++++++++++++++++++ target/classes/PingPong/Ball.class | Bin 409 -> 968 bytes 2 files changed, 18 insertions(+) diff --git a/src/main/java/PingPong/Ball.java b/src/main/java/PingPong/Ball.java index 8c17da9..1e75d0c 100644 --- a/src/main/java/PingPong/Ball.java +++ b/src/main/java/PingPong/Ball.java @@ -1,10 +1,28 @@ package PingPong; import java.awt.*; +import java.util.Random; public class Ball extends Rectangle { + int xVelocity; int yVelocity; +int ballSpeed = 3; +Random random; + + Ball(int x, int y , int width, int height){ + super(x,y,width,height); + random =new Random(); + int randomXDirection = random.nextInt(2); + if (randomXDirection == 0) + randomXDirection--; + setXDirection(randomXDirection * ballSpeed); + + int randomYDirection = random.nextInt(2); + if (randomYDirection == 0) + randomYDirection--; + setYDirection(randomYDirection * ballSpeed); + } public void setXDirection (int randomXDirection){ xVelocity = randomXDirection; } diff --git a/target/classes/PingPong/Ball.class b/target/classes/PingPong/Ball.class index df86139f7104a743db174b51390e9ca210496641..533736eca023d51258f45a744ebbc5b3d0b8c337 100644 GIT binary patch literal 968 zcmZ`%?M@R>5Iwi;?$Wx@QYeTmAbyrrsiN`+CC0DNq#8n-Mt*MFO?$QMlClW=_bGe} z6M;k%AHZia;+bu!O7tdo@9fOnGw00Q??1nM1MnCRQ-~pMAz{OSsgQl^zIRLRepuS{ znxX5ryPksiNc%cmQ?QC0E*|-2(VRS?L?Tx^1m!7)au0pcGqq^gHEd^D! zFs6`+aQ8ypEp57fE7(q96d5Txt`INwAt!81BFB2YD1~e)=dZ2Gy=fa4F+)1OcMz8S zP$5w)FP2kemA6sAEGg}J;hX2WM-e*k`w4YPn748HEMaSyAcC&gxGHLr2X(I-GzWp_N??odspum4Z}1J`fHlvoYj=DSz!&Y(`J8tnC&-b*b^k}`=U=^hrS zBF14SxG9idh@|M`_@a|-=NaebD}cgHK#>?MdTLI-Fq=!9Ksn|SEaxjmw@#2gLe}|= ztZ|H~6(eVSg!#cZb#exsR_7R(hCwrDO3-A`90cb+Mb(P@E=LT;kVFb&NMi;WvK&Vd zS=_<|R>5IZH1X<BwX1w*za06j0O2A7McR#7GjPE#5pK3lXuYe%6qf d85I;PzPo>6T|198N38k(U-sDS+O7)CD-P{a3K$3}pk%5(g4M_3=dHO&aB*&_?oq=&9 zSeg$=f~0|h4E#Wn2g(*;5CrlV8H5;wfh0(?9ndf)AkC&Fy_JC-p_>aV$^q2R2{u8D YK_0A(0b&HmcoDF%j0~bc?Mw_}0HYKe&;S4c From c2f49ff0a27f60a908f3b255fc5d8819df99f4d2 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 21:55:36 +0100 Subject: [PATCH 04/29] update --- src/main/java/PingPong/Ball.java | 4 ++++ .../BattleShip/AIGridGUI$DirectionCompare.class | Bin 0 -> 1093 bytes .../BattleShip/AIGridGUI$SetShipsListener.class | Bin 0 -> 3319 bytes target/classes/BattleShip/GridGUI.class | Bin 0 -> 2132 bytes target/classes/Snake/Controller$1.class | Bin 0 -> 767 bytes target/classes/Snake/Controller$2.class | Bin 0 -> 1202 bytes target/classes/Snake/Controller$3.class | Bin 0 -> 1280 bytes target/classes/Snake/Controller$GameState.class | Bin 0 -> 1166 bytes target/classes/Snake/Controller$MoveAction.class | Bin 0 -> 1135 bytes target/classes/Snake/Game.class | Bin 0 -> 1081 bytes 10 files changed, 4 insertions(+) create mode 100644 target/classes/BattleShip/AIGridGUI$DirectionCompare.class create mode 100644 target/classes/BattleShip/AIGridGUI$SetShipsListener.class create mode 100644 target/classes/BattleShip/GridGUI.class create mode 100644 target/classes/Snake/Controller$1.class create mode 100644 target/classes/Snake/Controller$2.class create mode 100644 target/classes/Snake/Controller$3.class create mode 100644 target/classes/Snake/Controller$GameState.class create mode 100644 target/classes/Snake/Controller$MoveAction.class create mode 100644 target/classes/Snake/Game.class diff --git a/src/main/java/PingPong/Ball.java b/src/main/java/PingPong/Ball.java index 1e75d0c..6702635 100644 --- a/src/main/java/PingPong/Ball.java +++ b/src/main/java/PingPong/Ball.java @@ -30,4 +30,8 @@ Random random; yVelocity = randomYDirection; } + public void move(){ + x += xVelocity; + y += yVelocity; + } } diff --git a/target/classes/BattleShip/AIGridGUI$DirectionCompare.class b/target/classes/BattleShip/AIGridGUI$DirectionCompare.class new file mode 100644 index 0000000000000000000000000000000000000000..6155fb49f239808eacdc7f7d42973b6018a0b34b GIT binary patch literal 1093 zcmZuwTXWJt6#f>FKpJR@h}J7Am8+%J+XI!c(y?ZSX`P|+9_UKbNs~@k>YwtZbIy0p{{8psH-I;Il|~G42?+()kYw0+rwd{7-idME+|~9S z<9Pp*R@yThJ`{#+b?mcq-Qf&Labk>1TMUKnvKuWKDWoOH3Ra*nsHggc-ZXV<)I1!V z5*IP-7?vU04Dm{}FC&Xp395oM+97E@?9IxFMmS;3jS{tj%I* zmf$1qFi01=IpK$&DbI>l?JgiF&pd7`xP!Y4>7ifUk?q2lfZdQW+*j}bMdA+N49!YZ zgfQXOa&J|W@Q7;kl9>p@Z2GF|!lsPZ=eWWaw5olEM8`fR?N_^o#SbQD1MVE@1Cun$JEDTPRgiZfMBdqr1qx3@DNN@-3LK$Bu;AukI7r2U7HXwvU08d9jx{P(j}c@ z*r0EcFkqK>Li>V`LKzi05#D2CgrM08xIPlbWzRLH$o$0hx^Jdf|4QB{=QoeD=%Yi< z9IB|fF_A-^b}@CA*c$=+YeKv1nOgl1vJF~O+`CHbC#!fQnSeNfr(XC?G(Ee8XP({0 N3$ij{W7x(^;6LYf`c(h` literal 0 HcmV?d00001 diff --git a/target/classes/BattleShip/AIGridGUI$SetShipsListener.class b/target/classes/BattleShip/AIGridGUI$SetShipsListener.class new file mode 100644 index 0000000000000000000000000000000000000000..5478518ad5db1452e7baa3f03f0e16913b5d1992 GIT binary patch literal 3319 zcmcImX>b%(5dJz@GMmkige(TbAqxgcK(Y#+ETSZGtR?{y3*?3W*I)OW zgMYuW55PruwipE{)DX}y4n>4n^@fy|Xib^j(IxTaj+tD3WxTpoNF{L_O;?Jva0o>* zWxCa85h@$=orr}HM6rgDjuPmE@=Zps5w(nTM|5TTCXtYAVUd|OJ8Ur6|)- zu44i!2vwfC(I=y#SEOaM$?kE*Qne%$cW^LvkCPCDi8Zy2qbd&yj%hf}56gGsWfU)F zXAvDUFq1GYVF`mlqjgGJtz#C>AOsD|@=zt5;%Ct#O)I*@af|^4bWADN=%~dULW#@x zueMiNhRSm=0Ae3gH68bS%O}?3oWY8(m{c)+!w{-4Ux`E?%tT z5-cH1>M}Y-gPl$oa*ZidymFWZ9fbF`N0 zSfMJRwR`+<)yd0rT&`rrR)*`Yh9<()e2mPtLkMB4)UgUzF!GM*vU`Qc*z9}4j7;dG zD4kV^DK3T4s$(^-B!pZcm!^$&OC&jknsv2pL98L1+9HhPKt$RRM#Pa3nG%r>2DMJb zeU*-NifbNGT#qM7CBIt7HA)`r6^=9$hNWtHosJDKSZGS&7}92LR%TntBTYObkCh;S zqz0j5BRUw!5ng3g7`~L@HhVa8E3Z>0OdXq49|zJbR+(8kx{zj$Fb`B)aaDPcsG^41 z?h>{lqV1kE>c8YB2t(@VK`+;jG0dJh z%|}1~q1v|5Ej~O9xGbDQgPmmFmNlAb(cIJ3E}Ye>GKy3-!`WsyrrKwO0W}v1vvYGA zwl`*u#t3?sH`^EvM^!r$YIGD)yxHf4L+shdAioX=oM3>}Ov!w4XV{$Nab(EHlwLvR&l}*E1UOC-gE? z0aZE-K%JrwyKEM&Tw%N1ndSAiEnVpt-AzKK?4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>^6{^;t*1Cfe;psgS+EjXYjbo#V$|5QRx zMC7@Ime4QHUY@+Ei>1}ymT<^S$*ou=Qr`+LJjA6HT>c)B zn<1fM{k*h#d}(#NY;+K^(bL$?Of^agnVrpbra_ zAM%~P#Sz`XL43w{`5xs19KpAIejjl>ztHn{>VM!E{^Se$7g6MJZg8lVh(FIk=tMn) z_o+pQ-35=DhELXZzvEiv+#o(j2|g)#izh1{cQ9G?=)eys(>KV>AK@Cc5Nr7n*NG&r z(Bmo<7O0pc~HG!EOEe|N^8*K}d=Tx*; z1!{IrmF*{-O)sW<5kk}hL@}lj3$*s-u}pHQcayineabA~ey+5#YXVc9aE zwvNU_rj)~+k(tzFG9So7xp)Fr-3tX~FLAY3drTsI(`_m~m|{#Lfu&CRPhA^MW6$*$ z+-l)}MFP=|IVv)GrJSthx#cU4nvo5i<)&16ca!X%899d^2yC7{_`T92bJCkg_D22{ z3>2MZ*AEYKI?ejPXPwY+i%R?2l>DdSH<~@|=dvuR#66yj5NsGktL3JH2d2W`G-er{ zA u>N!*7@uvvz><_l^j4i|h7WsA+clmw=ORO9mHEp%_h{0AkG}vfovWV! literal 0 HcmV?d00001 diff --git a/target/classes/Snake/Controller$2.class b/target/classes/Snake/Controller$2.class new file mode 100644 index 0000000000000000000000000000000000000000..0beba0426960d0292bc77f299b603cf79e066b27 GIT binary patch literal 1202 zcmZuw*-{fh6g`~)Ly}1dVG)riFKRr3uDf)rR!Lh zaFY`ZEppfNlH;_St>4as(Tb3Uu#O0HhWH*o;D*KR9V55BCkm2IPnxzVrx=2%k$ea- zv}uUzXh(wR^?D4U9bOXal1stR*AOqcc(I!ap%Yyix^-MrQoZ$3S5)$_#><{4s_55s z^x_6Xq$E6#?})r9DrBSqsg;+PkuCoA!>1c}K@xq!^l|SrRToM^=^T(C{imFg6rO0n-@Oa8Jj5Rmk=R z1|9b#ccltq=onW)B5M{u5^mO^Q z*jdw)!d8yDQVpffjN~b;Ij2Y$(UvuBv05%|3wMKWTZAOCPJvr_?wV>{1DjN%FmyI( zB_}c@!u_CY!u{m9B~fG;O!V3^CkA8gScfo(nS4nge)GUSl75=$qBE0UD-GW#! zmCd%RP99S#gv{Fo%kil2D?;u%MIG~4VCdn+;%r$;$Nsl8lur9aZ8lB2=u~`Pt*cbv zCC8)w)|YK6;he=iPY^qF*`d@q0eT$_kHF$_^}guI1?Y?5387DEHbrZNgwvyEVCnDB zzWJPIG`0{2Siy4|yQ?g`K!#St_th9NCg~AZwZ7K0a_LjBQ$$bDag5>Wq9=HcJ~chT z&>5mtaQGY}Uodn@A3H`@9sL{+l%XJ$p&?2Jc#A03(Sr?IzlVWMvhV?m*upA4{$)0I uX*Ne`z9N&;bh-%vV}QmPng=k8IUkGRH7O`0h9&wZYN^nanmvZ)>E1tXJ`?`{ literal 0 HcmV?d00001 diff --git a/target/classes/Snake/Controller$3.class b/target/classes/Snake/Controller$3.class new file mode 100644 index 0000000000000000000000000000000000000000..acc6571238892782c61c7caebe8b8ac43385bd9e GIT binary patch literal 1280 zcmZuw+foxj5IqwDn}iLQa1oH38kLI@6fbB{fyhn6MMA|YpB$1Q3~Y9(-3j2Y_yN94 z0ap3o2lz`?S@vu;BEg59?e00#edhG^&)?sF0C<616d^Pi2%Bg`6GI|r^L>%ZIJR;f z%MxyKilIsEN-sG{yV?5fbPN$h4a7_|!(?dNH z6fI~q&}O0?34+(>V~Cb`S>zN~f}#IPz2s7DHyuSMx(sxixTaI})u+0EG8mf`+m?1o zm+v*vhwBW@W#M_eB=S-m5tE?QmN-^Al8#`2!PMo3H+aPp#fcb(Fl^w4iJQ2^&{8c} zJ3vJ|p|r=)HIlv1A*WoboF2{V^S4dh!Ci(pVe`_H+tQNi6GM39Lsgtn6Jr=>h-euu zQ`200YBAi$gn^WaNv(N6q_#~&Tyemqt+YZ9O-yNdnyQ!30z5YH1Wy?nl`IRFp~EM8 zobrx{XKG6asjbiO+(6pIj4sixuX71Ols)Af7@)=u_?P8JDkTnutx|IZB^^5}Jtb^i zfaIue4#`0oGER}Y+?tiPSgVw`g}cSKEs7+vPJvr_?n>}p3Yt*QYe94L>ofm}{g-?dM17){SlD0X2LXv#&Z)Qsu_!go){8Nj&{-(5 zU>7XMBOOr}+FeB)po(cqI9gh6%@aqOTMB_y$n2}n$1kBC|Skjwlfm%$R2iPQ?6Yy|s7 jpfKK$6T(|$=^v&SzKRV$(t>yNPXye_q=9I`=4{^|Crm2{ literal 0 HcmV?d00001 diff --git a/target/classes/Snake/Controller$GameState.class b/target/classes/Snake/Controller$GameState.class new file mode 100644 index 0000000000000000000000000000000000000000..7c0b6b785f7e4cae02e4f09329f85d6457095b49 GIT binary patch literal 1166 zcmaJ=?@!ZE6g_Y2)~ytn6G0}3BFYB3fr6+*f+3(J3lOVIh@T$giN*4obS;Vhm5xM+ zM#E?SDC2#P>IUkzWOw)8bAO!M(;q*-dv zY@>i{41I0Ds*Db3<{|eYvH6x^zSvQ{;_+s)+7WQVfOuCsC#VLx|EP`Y7$d5Su5`mC zhQZEOapiicomkP=A5d9y!Z^|jzV>;#cn$+RT(VDkAj9+a}|sJwiwH50cyP=n&At-8Jc*+kh>^A276sf z5$Iy_fXb((hs53#91Wi3z$>W zBgYu|q|=?_+T|uHYIV$L%xun5Vu}~3z@R8Fl>P>`oopfLY#S|@&UUIrcmA722KQ<9 z8SAyUxcrrB^EZ;mxOs%6cE%0unA*9O(vEe4i6iu?RnK3>h*x`nIm#t4kB8bW;4xYC L0x&G#$#UTr{*>}o literal 0 HcmV?d00001 diff --git a/target/classes/Snake/Controller$MoveAction.class b/target/classes/Snake/Controller$MoveAction.class new file mode 100644 index 0000000000000000000000000000000000000000..824eb043863d2ff0c6d973e4c6f5e7edb690992d GIT binary patch literal 1135 zcmah|+foxj5IvnlmV||bs2~9ZH6jGaf_Dv2P~kTTH+laTvlAK9O+;MkFS*4l2Me7mAr zah4qEs1-tddS*v67%-7WhLEf}zKFoaB8(6zAMVeZucaiixNP8xiK`eQWV-1POh+Ep z)P^mquBZ~|y>_`~VgxzH*|QJCwz8EVG;um|e%X9woH2|WxNc%X`{lZE@-0(>@wO%< zr>lW(n7D~sgjAsGx#?AfOX%;+hzoWbQwHvsn8pmDuMs-jnSCHsD_g?Ebf;@~F=loM zi%pAm8m0gFB-WW1AzgN)*s2}u3jdwG>#`*lUAL!CEc|8o4eXJ~TB&4z$bMRc>OPV}|ZMeXQYscNH>~GqK5u4PuSMw|4 zg`@eV+hmG53ZZvP1Zu+z6qoXql)_(k?H~}$Kh+*+1I#ySX;}BJ!V(5Tbw?wTt$t&Y z=eCzWQH&Q4FObRTKNM=fpP&H3EK9HXJgYcS4d-|t2%oPBHieQ;pm34~%}rNJE(9qyH!JT8h^( zsBz=axLG84uVWZzJc_><_q+qU*upO2F77er{m_%<+5G`uV|a*1;hDu_K69*(anL8c RKjnZ+t0Vk*vRGct{R95Z4{-nh literal 0 HcmV?d00001 diff --git a/target/classes/Snake/Game.class b/target/classes/Snake/Game.class new file mode 100644 index 0000000000000000000000000000000000000000..6d095ca8624966b8e11acd3340777c94a8a6dcc0 GIT binary patch literal 1081 zcmZ8gZBNr+6g>}g>(-5}0|cx1f+7@DCiA@m6nV>%O%os^(+^sW!YUw?l51h9fP8ip{eLP;ZrxPX3Sf3x$R?H}gf9UM9J zwm^K@_1*TWz_2-ARgn-#@A~#vC%^Cdjpn%q6`Dk+1Y%~XBx^#$J{Sru0v#eq13cL>NQOe@`f~v>f^B)Q|A9jp2o92i;2;-)6LPOGt@knO zwcc%>wd&56D^*F#gI|;v8q=8PJ(oYSmN%XDKAl;4c^UN=IuJSWds#26=-O%*YK@*= z=pbn+U8HOBHDkrP$klYMgE1@K#dxiQ2}|u_GKd*g!cZ=7%}N?cBYuIKd?fhjVy0#& zM$CvCs*&hmcKUE-7sKH)LnhS_rmPw Date: Tue, 7 Feb 2023 21:56:43 +0100 Subject: [PATCH 05/29] update --- src/main/java/PingPong/Ball.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/PingPong/Ball.java b/src/main/java/PingPong/Ball.java index 6702635..42d9752 100644 --- a/src/main/java/PingPong/Ball.java +++ b/src/main/java/PingPong/Ball.java @@ -34,4 +34,8 @@ Random random; x += xVelocity; y += yVelocity; } + public void draw(Graphics g){ + g.setColor(Color.red); + g.fillOval(x, y, width, height); + } } From a5e187c4be6a45cbe7b3dd06d25a87c512bafeca Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 22:03:22 +0100 Subject: [PATCH 06/29] 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#2r^R}J)flXp2oV+ z$Q`@AXduMyYkVOVW8k>`K_p?C8V{xTQgA}1czbQdE^S?yfo!4Ngo!dKf}Jy@?~B5g;X*g*~#(9 z4&-R?<%NL4mz@2@xyf}Hd#DZ7a{DhnsqZ3wu| zJ#xyhs;5{Q#kxU`3zx8r6w64lc&YyjYk3rFkyuOrgC#i-UK`ALQt}N7l{{9h-IuVa zb?LiPj$EvAvCPHlMSxPiQT1Q(-Wl%H2`CW+ k_%7ei&+uRryUs%2L=~%-1k9(&n8y~rCAz{kBWJMl4}aPC=l}o! delta 480 zcmZvXyG{Z@7=_R5y1QIfD=r#PKoAiTuNWGQg(g@_j6E*yCPot7M5uTI3$jmQqK$>M z@dYfk^&O0QW>ziKNoMBEnfbr}%uD>iiaoyH-2>P{V-$Ou7{74*qh0UZ>G)pnZ1h^F zMG?WQjUsG;X#dbT?R7kVAl*3|W#taO-5{s!r$t{t3zxD)@JnNhWObE;af)rSE+CfvV8`T?FZqU`sq7q!`#o;C^c96mz(r954 z2bjVFU$?> Date: Tue, 7 Feb 2023 22:05:36 +0100 Subject: [PATCH 07/29] refactoring: --- src/main/java/PingPong/Ball.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/PingPong/Ball.java b/src/main/java/PingPong/Ball.java index 22a7e65..bbc7809 100644 --- a/src/main/java/PingPong/Ball.java +++ b/src/main/java/PingPong/Ball.java @@ -19,6 +19,10 @@ Random random; xDirect(randomXDirection); int randomYDirection = random.nextInt(2); + yDirect(randomYDirection); + } + + private void yDirect(int randomYDirection) { if (randomYDirection == 0) randomYDirection--; setYDirection(randomYDirection * ballSpeed); From 875b7a4ef48ea3f170aaf2c5f7a377387e1c1321 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 22:11:41 +0100 Subject: [PATCH 08/29] update --- src/main/java/PingPong/GamePanel.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/main/java/PingPong/GamePanel.java b/src/main/java/PingPong/GamePanel.java index 89ff717..6101b6c 100644 --- a/src/main/java/PingPong/GamePanel.java +++ b/src/main/java/PingPong/GamePanel.java @@ -11,8 +11,14 @@ public class GamePanel extends JPanel implements Runnable { static final int PADDLE_HEIGHT = 100; public static final Dimension SCREEN = new Dimension(FRAME_WIDTH, FRAME_HEIGHT); + Ball ball; public void run() { + + } + public void newBall() { + + ball = new Ball((FRAME_WIDTH/2)-(BALL_DIAMETER/2), ((FRAME_HEIGHT/2)-(BALL_DIAMETER/2)), BALL_DIAMETER, BALL_DIAMETER); } } From 72ce816ac2918061926ff6b77e31dae7c0bcbadf Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 22:45:41 +0100 Subject: [PATCH 09/29] update --- src/main/java/PingPong/GamePanel.java | 18 ++++++++++++++++++ src/main/java/PingPong/Paddle.java | 4 ++++ src/main/java/PingPong/Score.java | 4 ++++ target/classes/PingPong/Ball.class | Bin 1504 -> 1604 bytes target/classes/PingPong/GamePanel.class | Bin 720 -> 1251 bytes 5 files changed, 26 insertions(+) diff --git a/src/main/java/PingPong/GamePanel.java b/src/main/java/PingPong/GamePanel.java index 6101b6c..3b982e5 100644 --- a/src/main/java/PingPong/GamePanel.java +++ b/src/main/java/PingPong/GamePanel.java @@ -2,6 +2,8 @@ package PingPong; import javax.swing.*; import java.awt.*; +import java.util.Random; + public class GamePanel extends JPanel implements Runnable { static final int FRAME_WIDTH = 1000; @@ -11,14 +13,30 @@ public class GamePanel extends JPanel implements Runnable { static final int PADDLE_HEIGHT = 100; public static final Dimension SCREEN = new Dimension(FRAME_WIDTH, FRAME_HEIGHT); + Ball ball; + Paddle paddle_1; + Paddle paddle_2; + Score score; public void run() { } + public void draw(Graphics g) { + score.draw(g); + paddle_1.draw(g); + paddle_2.draw(g); + ball.draw(g); + + } + public void newBall() { ball = new Ball((FRAME_WIDTH/2)-(BALL_DIAMETER/2), ((FRAME_HEIGHT/2)-(BALL_DIAMETER/2)), BALL_DIAMETER, BALL_DIAMETER); } + + + + } diff --git a/src/main/java/PingPong/Paddle.java b/src/main/java/PingPong/Paddle.java index c1483f2..dc71933 100644 --- a/src/main/java/PingPong/Paddle.java +++ b/src/main/java/PingPong/Paddle.java @@ -1,4 +1,8 @@ package PingPong; +import java.awt.*; + public class Paddle { + public void draw(Graphics g) { + } } diff --git a/src/main/java/PingPong/Score.java b/src/main/java/PingPong/Score.java index 10a75ce..b364a50 100644 --- a/src/main/java/PingPong/Score.java +++ b/src/main/java/PingPong/Score.java @@ -1,4 +1,8 @@ package PingPong; +import java.awt.*; + public class Score { + public void draw(Graphics g) { + } } diff --git a/target/classes/PingPong/Ball.class b/target/classes/PingPong/Ball.class index 55cdf373e74fa3a532ddcf289cc8a74d0d81e69c..5a6f0b6f166c841d3996d901f6cfe6351b6990f0 100644 GIT binary patch literal 1604 zcmZ`(>vG#<5Ivt`OR=LkiBqREb||HnIC5JjT*}3zg`~7KIBlA=rWyXA*uoYlQbtv7 z|9J}D0;X|iV1@_aHFyugS;>)u2Q;Java9dxp0oSu&%b~B1HfnaCWjQpbfgVrpeYo7 zunw%6br{w*?RIE+UDsC7?mC_m-c!&k4L(b)EXI-5kuxv>Lt%2m@wywn*R8EuuB(vU z;k319+Z_ef(2-Y|j&S!w$E|HzUdP|fVG`34bVgyU5<|`!xPT(#1<@zWra5}7F6S;9 zcng=9j%Oc*4KGwkR~k!=9J4AJC}V-HqX$kv2C=IpuFD4AiCo9AOKk5NxGJ{ES9Z7^ zn;qX1&vgSg&O9#@j}WgISQ6IRqn7RZZ6`byYt_Kb$a;Lp<76@b znXQbTk7fScz!#E6=FsVcJxOfMzyq;pJ=^K_LJ9NGz$0mh@$VhieR^QIRC3Mlup6eD zj%PpF-`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mbqXHMSEm@A<`m)ETsf?owH_Gv@A55xWv+7MEr{2cX%c|bAjcrm>=i_ wZLVeB=M`5G(LQ$oIfpUMQOYNBiPgi1_bMW;FA)EX`;tt!+8CmjC+0!nFWu(aQ2+n{ delta 328 zcmYj~Pfo&67{upmZAW$_R~aIA0wZ7Rv7 zZ(iif)Xv?a2OkLrIOW5TJq}`WVsT2!EIuQjTYN#jw0MNH* Date: Tue, 7 Feb 2023 22:49:13 +0100 Subject: [PATCH 10/29] update --- src/main/java/PingPong/GamePanel.java | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/main/java/PingPong/GamePanel.java b/src/main/java/PingPong/GamePanel.java index 3b982e5..8c6e88a 100644 --- a/src/main/java/PingPong/GamePanel.java +++ b/src/main/java/PingPong/GamePanel.java @@ -18,6 +18,8 @@ public class GamePanel extends JPanel implements Runnable { Paddle paddle_1; Paddle paddle_2; Score score; + Image image; + Graphics graphics; public void run() { @@ -30,6 +32,12 @@ public class GamePanel extends JPanel implements Runnable { ball.draw(g); } + public void paint(Graphics g) { + image = createImage(getWidth(), getHeight()); + graphics = image.getGraphics(); + draw(graphics); + g.drawImage(image, 0, 0, this); + } public void newBall() { From b04197146700518841c771e65261534a786739eb Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 22:54:24 +0100 Subject: [PATCH 11/29] update --- src/main/java/PingPong/CollisionChecker.java | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 src/main/java/PingPong/CollisionChecker.java diff --git a/src/main/java/PingPong/CollisionChecker.java b/src/main/java/PingPong/CollisionChecker.java new file mode 100644 index 0000000..6543814 --- /dev/null +++ b/src/main/java/PingPong/CollisionChecker.java @@ -0,0 +1,7 @@ +package PingPong; + +public class CollisionChecker { + public Boolean didTouchTopOrBottomEdge(Integer ballYCoordinate, Integer maxHeight) { + return ballYCoordinate <= 0 || ballYCoordinate >= maxHeight; + } +} From 4f7cc9dec0f9f8210152b3ba6dad09ae8078373d Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 22:55:24 +0100 Subject: [PATCH 12/29] update --- src/main/java/PingPong/CollisionChecker.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/PingPong/CollisionChecker.java b/src/main/java/PingPong/CollisionChecker.java index 6543814..c2cf1ca 100644 --- a/src/main/java/PingPong/CollisionChecker.java +++ b/src/main/java/PingPong/CollisionChecker.java @@ -1,7 +1,12 @@ package PingPong; +import java.awt.*; + public class CollisionChecker { public Boolean didTouchTopOrBottomEdge(Integer ballYCoordinate, Integer maxHeight) { return ballYCoordinate <= 0 || ballYCoordinate >= maxHeight; } + public Boolean didTouchPaddle(Rectangle ball, Rectangle paddle) { + return ball.intersects(paddle); + } } From 2b5154085bcb889fae1860fe38ec17a3859d08e6 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 22:56:34 +0100 Subject: [PATCH 13/29] update --- src/main/java/PingPong/CollisionChecker.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/PingPong/CollisionChecker.java b/src/main/java/PingPong/CollisionChecker.java index c2cf1ca..a38b4f8 100644 --- a/src/main/java/PingPong/CollisionChecker.java +++ b/src/main/java/PingPong/CollisionChecker.java @@ -9,4 +9,8 @@ public class CollisionChecker { public Boolean didTouchPaddle(Rectangle ball, Rectangle paddle) { return ball.intersects(paddle); } + + public Boolean didTouchLeftEdge(Integer ballXCoordinate) { + return ballXCoordinate <= 0; + } } From 4103bce4039992430684a8d03fa23e6719d1e99c Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 22:57:05 +0100 Subject: [PATCH 14/29] update --- src/main/java/PingPong/CollisionChecker.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/main/java/PingPong/CollisionChecker.java b/src/main/java/PingPong/CollisionChecker.java index a38b4f8..59c3ed0 100644 --- a/src/main/java/PingPong/CollisionChecker.java +++ b/src/main/java/PingPong/CollisionChecker.java @@ -13,4 +13,8 @@ public class CollisionChecker { public Boolean didTouchLeftEdge(Integer ballXCoordinate) { return ballXCoordinate <= 0; } + public Boolean didTouchRightEdge(Integer ballXCoordinate, Integer maxWidth) { + return ballXCoordinate >= maxWidth; + } + } From b5f10c9c7092c928d07025d610dd5b7db89e0067 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 23:11:51 +0100 Subject: [PATCH 15/29] update --- src/main/java/PingPong/GamePanel.java | 13 +++++++++++++ src/main/java/PingPong/Paddle.java | 4 ++++ 2 files changed, 17 insertions(+) diff --git a/src/main/java/PingPong/GamePanel.java b/src/main/java/PingPong/GamePanel.java index 8c6e88a..8a128f7 100644 --- a/src/main/java/PingPong/GamePanel.java +++ b/src/main/java/PingPong/GamePanel.java @@ -2,6 +2,8 @@ package PingPong; import javax.swing.*; import java.awt.*; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; import java.util.Random; @@ -21,9 +23,12 @@ public class GamePanel extends JPanel implements Runnable { Image image; Graphics graphics; + + public void run() { + } public void draw(Graphics g) { score.draw(g); @@ -44,6 +49,14 @@ public class GamePanel extends JPanel implements Runnable { ball = new Ball((FRAME_WIDTH/2)-(BALL_DIAMETER/2), ((FRAME_HEIGHT/2)-(BALL_DIAMETER/2)), BALL_DIAMETER, BALL_DIAMETER); } + public class AL extends KeyAdapter { + + public void keyPressed(KeyEvent e) { + paddle_1.pressed(e); + paddle_2.pressed(e); + } + } + diff --git a/src/main/java/PingPong/Paddle.java b/src/main/java/PingPong/Paddle.java index dc71933..5613614 100644 --- a/src/main/java/PingPong/Paddle.java +++ b/src/main/java/PingPong/Paddle.java @@ -1,8 +1,12 @@ package PingPong; import java.awt.*; +import java.awt.event.KeyEvent; public class Paddle { public void draw(Graphics g) { } + + public void pressed(KeyEvent e) { + } } From 193121ef52721b41a8008775fd46b02f701f87d5 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 23:12:54 +0100 Subject: [PATCH 16/29] update --- src/main/java/PingPong/GamePanel.java | 4 ++++ src/main/java/PingPong/Paddle.java | 3 +++ 2 files changed, 7 insertions(+) diff --git a/src/main/java/PingPong/GamePanel.java b/src/main/java/PingPong/GamePanel.java index 8a128f7..639d25a 100644 --- a/src/main/java/PingPong/GamePanel.java +++ b/src/main/java/PingPong/GamePanel.java @@ -56,6 +56,10 @@ public class GamePanel extends JPanel implements Runnable { paddle_2.pressed(e); } } + public void keyReleased(KeyEvent e) { + paddle_1.released(e); + paddle_2.released(e); + } diff --git a/src/main/java/PingPong/Paddle.java b/src/main/java/PingPong/Paddle.java index 5613614..8818b4e 100644 --- a/src/main/java/PingPong/Paddle.java +++ b/src/main/java/PingPong/Paddle.java @@ -9,4 +9,7 @@ public class Paddle { public void pressed(KeyEvent e) { } + + public void released(KeyEvent e) { + } } From 22e98a7a49ec699fb0c062b1957e5dbcdb73ee83 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 23:22:48 +0100 Subject: [PATCH 17/29] update --- src/main/java/PingPong/GamePanel.java | 11 +++++++++++ src/main/java/PingPong/Paddle.java | 3 +++ target/classes/PingPong/GamePanel.class | Bin 1251 -> 2007 bytes target/classes/PingPong/Paddle.class | Bin 261 -> 604 bytes target/classes/PingPong/Score.class | Bin 258 -> 383 bytes 5 files changed, 14 insertions(+) diff --git a/src/main/java/PingPong/GamePanel.java b/src/main/java/PingPong/GamePanel.java index 639d25a..fb3af78 100644 --- a/src/main/java/PingPong/GamePanel.java +++ b/src/main/java/PingPong/GamePanel.java @@ -25,17 +25,28 @@ public class GamePanel extends JPanel implements Runnable { + + + public void run() { } + public void draw(Graphics g) { score.draw(g); paddle_1.draw(g); paddle_2.draw(g); ball.draw(g); + } + public void move() { + + paddle_1.move(); + paddle_2.move(); + ball.move(); + } public void paint(Graphics g) { image = createImage(getWidth(), getHeight()); diff --git a/src/main/java/PingPong/Paddle.java b/src/main/java/PingPong/Paddle.java index 8818b4e..eb15f54 100644 --- a/src/main/java/PingPong/Paddle.java +++ b/src/main/java/PingPong/Paddle.java @@ -12,4 +12,7 @@ public class Paddle { public void released(KeyEvent e) { } + + public void move() { + } } diff --git a/target/classes/PingPong/GamePanel.class b/target/classes/PingPong/GamePanel.class index 6da66e176fe8e6b09e420e512c0ca34476b59989..7d69b478a9cb01d736ec9e040a0b0215c0ffceca 100644 GIT binary patch literal 2007 zcmZWqT~pge6g_JL1|z^G!7U_d10fAINerZ4se#sD0|G-_L!qP}RM=aiM95TxN>)BP~ zSe6Z2T5)utJBA(&G4wLyg>h>9oOREbm|gcX1bXI8+w>L%qEqSJJ_y7$^g|QqcB>6X z3M5KF<82km#W9GX7!n$i7#0}(@3KHw%`wgdQd1>`mo?73?5bm&9GO)&*MhjIVFW3G z-V>u%v*f|7K(d2U_Jf3ZSHX-53UNU1KpJ+tN=`GV+bDXk%+mioA~Ce8Yhr=kxvJi=pv{;DGl zPwK};onqab()Dy_-+nZwsLg1Y#T->NTZxJ5NpXCLk7D>(!zcKZss`G%JNFa)N=AW^ zsSwIl*a!MdLk{z5BW=wEZgjAMRJDbnI6lW0G2}HYVVP$TU|ywh)9NtW6rO}mw6!x` z@3i(emi6P$4qfS-N+*|ot~4*I`CAc)Q5?#%t4?-JgN}95bfhH>SJnh>huX_iX?xiX z`KqX1I5shq+5_wlRKYx!wre)*I5x1Q`ah$#N_>BYztm8{HivtAxl$}{@mxAQgVJ0K zUtRUI41N-orfnOC7LT!irIOz)9_;CboizcWb7Gbow(A+Tw`*8U83m$m1hiJ#T2WtJ z+hI(+W#Ur4R5~c=tlueC7{nM8%lSf~)NZI^oa%vgET{%G=vr>nh(A;^ZMoGvK9tT* zi_vhYQ8lbx!!ecL4t9A*rmHp=jC1hm=QzJk(kg*h=y+v5S)@=OgpH~3P%sszdl zLXLJ6x+XpkX})T;Z;AMJqv=%Tim7B84B#HC(P7&y>3W+|@pfY%wUPfbo6PehHQlzQ zvuqizE14F_moUzW?BcTnjq|aKJ-&ZUsUp~?|2*V>L;u^5{~i7BL;eB%A40x?Q8ff|UU)ZDD1t&>tt?llk}wh4@yu`No4&vR?G4&@Xvf<24()iSaSGim zm>~8&Brr)i?sMA@e4tdTSsRFLam1~vjhO+Y$9e@hlgVT*Fv(}?0@LTnW{8=+z>{-4 zRj*GkurRGc(I|5k_pUQY6Fq}lm?n>hlrwQ>dRB44{ delta 501 zcmYk2OHKko5QhIAXa+{2j)YNEj35XjJ`mpzl$Q@Y0Es&_F>x_r>p9Gvz#|Z2Of>NT zUck847?&!eu1<1&VTJK(ecjFzue(me$!mCxl2~tU??0 zeTgb+B!T*WE&YPejCJT}=nE5yQ1pZ*M*JZkvQ+hIElAo4wwuH-l3Z~L)BGxaPNPkA zwVv0&0o4MB-BsU0NhfoUWPi579e@nt$SU)#ZjUgIdW+k9R_~Zk$eo&jFH`(Hz`n!0 P*GwosGDtdROhfYzKn^rn diff --git a/target/classes/PingPong/Paddle.class b/target/classes/PingPong/Paddle.class index 79e7e2d1030c28d0ea89577088cf0bb63aa2912f..4c524880858a1682bd8d33d824adcec5d9debbd4 100644 GIT binary patch literal 604 zcmaiw&rZTX5XQfOLJ^QZq9}?aMZGre$o=iOW06vs) zwk6S^h9>*XPG`PfX6NJc?H#~5I%VXLw_#OLK#|axiiL0j5ssbv(NuZ~p?Ic3m0S?= z-QLhfiBKP?a6E{(XCQn(kOb>8@;TI970SE$(@5$^F*1c6H}XU<6k3^l_0viwDke1D zHBO&Fz7|VDyX&Tdh-Kp3Xfc~8FYfn-1R4`sf7A%}Ov^ZyKH>0(SuSLlIJffo%3Lx8 zkJb4`taT7dS_V?2r1C>F*Pgsq<|&ozu_tCQ9Kq(rna={5)v<1I=5QpAh2vMy3tw_5 zvzoHe3TriM;JD2hp@urEF`x1=&|k(ff$?3=9mm3<49m`X{S1sxUH6_F>eLWoF<83iB{90!daN%?qR%8Tf!C H69Yd0hAIe( diff --git a/target/classes/PingPong/Score.class b/target/classes/PingPong/Score.class index 29c99b7a8811cc49e013adfe1d8791e8999242ee..52090d3343f69c1945c7d15944d20a5fe60f00b4 100644 GIT binary patch delta 179 zcmZo-`p?95>ff$?3=9mm3?dV`dd*o)=o z7#SGT85x8z7SsY9N delta 38 ucmey*)WpPf>ff$?3=9mm3<49mdM92~W@McBRf~~%vI3(xD+2=)13v)&LJDC3 From 9bcb52aa765944c47bc746996a3dbd21141bdfd2 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 23:29:38 +0100 Subject: [PATCH 18/29] update --- src/main/java/PingPong/Score.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/main/java/PingPong/Score.java b/src/main/java/PingPong/Score.java index b364a50..6956bae 100644 --- a/src/main/java/PingPong/Score.java +++ b/src/main/java/PingPong/Score.java @@ -2,7 +2,21 @@ package PingPong; import java.awt.*; -public class Score { +public class Score extends Rectangle { + static int FRAME_WIDTH; + static int FRAME_HEIGHT; + public final int COURT_CIRCLE = 150; + public final int CENTER_DOT = 10; + int player_1; + int player_2; public void draw(Graphics g) { + g.setColor(Color.white); + g.setFont(new Font("Consolas", Font.BOLD,50)); + g.drawLine(FRAME_WIDTH/2, 0, FRAME_WIDTH/2, FRAME_HEIGHT); + g.drawOval((FRAME_WIDTH/2)-(COURT_CIRCLE/2), (FRAME_HEIGHT/2) - (COURT_CIRCLE/2), COURT_CIRCLE,COURT_CIRCLE); + g.fillOval((FRAME_WIDTH/2)-(CENTER_DOT/2), (FRAME_HEIGHT/2) - (CENTER_DOT/2), CENTER_DOT,CENTER_DOT); + g.drawString(String.valueOf(player_1/10) + String.valueOf(player_1%10), (FRAME_WIDTH/2)- 75, 50); + g.drawString(String.valueOf(player_2/10) + String.valueOf(player_2%10), (FRAME_WIDTH/2)+ 20, 50); + } } From d1886f08a1764c5b4bd02f0cb1ad2b664eaf73ef Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 23:35:40 +0100 Subject: [PATCH 19/29] update --- src/main/java/PingPong/Paddle.java | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/main/java/PingPong/Paddle.java b/src/main/java/PingPong/Paddle.java index eb15f54..3131276 100644 --- a/src/main/java/PingPong/Paddle.java +++ b/src/main/java/PingPong/Paddle.java @@ -3,10 +3,23 @@ package PingPong; import java.awt.*; import java.awt.event.KeyEvent; -public class Paddle { - public void draw(Graphics g) { - } +public class Paddle extends Rectangle{ + int y1; + int y2; + int id; + Paddle(int x, int y, int width, int height, int id) { + //super(x, y, width, height); + this.x = x; + if (id == 1) { + y1 = y; + } else if (id == 2) { + y2 = y; + } + this.width = width; + this.height = height; + this.id = id; + } public void pressed(KeyEvent e) { } From 3ecee36fd2b953b009c51cf0de022158dabaf593 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 23:38:17 +0100 Subject: [PATCH 20/29] update --- src/main/java/PingPong/Paddle.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/main/java/PingPong/Paddle.java b/src/main/java/PingPong/Paddle.java index 3131276..4135fd9 100644 --- a/src/main/java/PingPong/Paddle.java +++ b/src/main/java/PingPong/Paddle.java @@ -3,10 +3,12 @@ package PingPong; import java.awt.*; import java.awt.event.KeyEvent; -public class Paddle extends Rectangle{ +public class Paddle extends Rectangle { int y1; int y2; int id; + int yVelocity1; + int yVelocity2; Paddle(int x, int y, int width, int height, int id) { //super(x, y, width, height); @@ -20,7 +22,9 @@ public class Paddle extends Rectangle{ this.height = height; this.id = id; } + public void pressed(KeyEvent e) { + } public void released(KeyEvent e) { @@ -28,4 +32,12 @@ public class Paddle extends Rectangle{ public void move() { } + + public void setYDirection(int yDirection, int paddleId) { + if (paddleId == 1) { + yVelocity1 = yDirection; + } else if (paddleId == 2) { + yVelocity2 = yDirection; + } + } } From 4acc547bae89f70af2d299658b7b88827833b4ce Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 23:41:21 +0100 Subject: [PATCH 21/29] update --- src/main/java/PingPong/Paddle.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/main/java/PingPong/Paddle.java b/src/main/java/PingPong/Paddle.java index 4135fd9..abe5d60 100644 --- a/src/main/java/PingPong/Paddle.java +++ b/src/main/java/PingPong/Paddle.java @@ -31,7 +31,11 @@ public class Paddle extends Rectangle { } public void move() { - } + + y1 += yVelocity1; + y2 += yVelocity2; + } + public void setYDirection(int yDirection, int paddleId) { if (paddleId == 1) { @@ -40,4 +44,5 @@ public class Paddle extends Rectangle { yVelocity2 = yDirection; } } + } From f0109dfba08d1e085bdc47f9547b05cbd25c15d4 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 23:42:06 +0100 Subject: [PATCH 22/29] refactoring: --- src/main/java/PingPong/Paddle.java | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/main/java/PingPong/Paddle.java b/src/main/java/PingPong/Paddle.java index abe5d60..25546ae 100644 --- a/src/main/java/PingPong/Paddle.java +++ b/src/main/java/PingPong/Paddle.java @@ -32,9 +32,17 @@ public class Paddle extends Rectangle { public void move() { - y1 += yVelocity1; - y2 += yVelocity2; - } + yVol1(); + yVol2(); + } + + private void yVol2() { + y2 += yVelocity2; + } + + private void yVol1() { + y1 += yVelocity1; + } public void setYDirection(int yDirection, int paddleId) { From 1c7e2e302e9c148cf3b69363660c2ec35ebfd311 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 23:47:12 +0100 Subject: [PATCH 23/29] update --- src/main/java/PingPong/Paddle.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/main/java/PingPong/Paddle.java b/src/main/java/PingPong/Paddle.java index 25546ae..878807c 100644 --- a/src/main/java/PingPong/Paddle.java +++ b/src/main/java/PingPong/Paddle.java @@ -23,6 +23,7 @@ public class Paddle extends Rectangle { this.id = id; } + public void pressed(KeyEvent e) { } @@ -53,4 +54,13 @@ public class Paddle extends Rectangle { } } + public void draw(Graphics g) { + if (id == 1) { + g.setColor(Color.BLUE); + g.fillRect(x, y1, width, height); + } else { + g.setColor(Color.YELLOW); + g.fillRect(x, y2, width, height); + } + } } From b4e47dc1c61a659d557a949f5b4e3ce9258a2aa3 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 23:50:45 +0100 Subject: [PATCH 24/29] refactoring: --- src/main/java/PingPong/Paddle.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/PingPong/Paddle.java b/src/main/java/PingPong/Paddle.java index 878807c..5d14044 100644 --- a/src/main/java/PingPong/Paddle.java +++ b/src/main/java/PingPong/Paddle.java @@ -59,8 +59,12 @@ public class Paddle extends Rectangle { g.setColor(Color.BLUE); g.fillRect(x, y1, width, height); } else { - g.setColor(Color.YELLOW); + Paddle1(g); g.fillRect(x, y2, width, height); } } + + private static void Paddle1(Graphics g) { + g.setColor(Color.YELLOW); + } } From ccf2517fbfa153dac3fa54ffac2725f18ba74958 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 23:52:15 +0100 Subject: [PATCH 25/29] refactoring: --- src/main/java/PingPong/Paddle.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/PingPong/Paddle.java b/src/main/java/PingPong/Paddle.java index 5d14044..eb5f8d0 100644 --- a/src/main/java/PingPong/Paddle.java +++ b/src/main/java/PingPong/Paddle.java @@ -56,7 +56,7 @@ public class Paddle extends Rectangle { public void draw(Graphics g) { if (id == 1) { - g.setColor(Color.BLUE); + Paddle2(g); g.fillRect(x, y1, width, height); } else { Paddle1(g); @@ -64,6 +64,10 @@ public class Paddle extends Rectangle { } } + private static void Paddle2(Graphics g) { + g.setColor(Color.BLUE); + } + private static void Paddle1(Graphics g) { g.setColor(Color.YELLOW); } From f8c27dbd867357fc3152cb3644014ebdf921c161 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 23:53:59 +0100 Subject: [PATCH 26/29] update --- src/main/java/PingPong/Paddle.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/main/java/PingPong/Paddle.java b/src/main/java/PingPong/Paddle.java index eb5f8d0..d38778b 100644 --- a/src/main/java/PingPong/Paddle.java +++ b/src/main/java/PingPong/Paddle.java @@ -9,6 +9,7 @@ public class Paddle extends Rectangle { int id; int yVelocity1; int yVelocity2; + int speed = 1; Paddle(int x, int y, int width, int height, int id) { //super(x, y, width, height); @@ -29,6 +30,19 @@ public class Paddle extends Rectangle { } public void released(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_W) { + setYDirection(-speed, 1); + } else if (e.getKeyCode() == KeyEvent.VK_S) { + setYDirection(speed, 1); + } + + // Check if UP or DOWN key was pressed (for paddle 2) + if (e.getKeyCode() == KeyEvent.VK_UP) { + setYDirection(-speed, 2); + } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { + setYDirection(speed, 2); + } + move(); } public void move() { From 34b141620d62f8644531575f998317f4e478c50f Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 7 Feb 2023 23:55:20 +0100 Subject: [PATCH 27/29] refactoring: --- src/main/java/PingPong/Paddle.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/PingPong/Paddle.java b/src/main/java/PingPong/Paddle.java index d38778b..df6696d 100644 --- a/src/main/java/PingPong/Paddle.java +++ b/src/main/java/PingPong/Paddle.java @@ -9,7 +9,7 @@ public class Paddle extends Rectangle { int id; int yVelocity1; int yVelocity2; - int speed = 1; + int speed = 10; Paddle(int x, int y, int width, int height, int id) { //super(x, y, width, height); From a7b12d0a7ce5c67cd05602cc329d7b9da27dc467 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Wed, 8 Feb 2023 00:03:11 +0100 Subject: [PATCH 28/29] update --- src/main/java/PingPong/Paddle.java | 20 +++++++++++++++++--- src/main/java/PingPong/Score.java | 3 +++ 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/src/main/java/PingPong/Paddle.java b/src/main/java/PingPong/Paddle.java index df6696d..34cad3f 100644 --- a/src/main/java/PingPong/Paddle.java +++ b/src/main/java/PingPong/Paddle.java @@ -7,9 +7,12 @@ public class Paddle extends Rectangle { int y1; int y2; int id; + int x; int yVelocity1; int yVelocity2; int speed = 10; + int width; + int height; Paddle(int x, int y, int width, int height, int id) { //super(x, y, width, height); @@ -25,18 +28,29 @@ public class Paddle extends Rectangle { } - public void pressed(KeyEvent e) { + public void released(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_W) { + setYDirection(0, 1); + } else if (e.getKeyCode() == KeyEvent.VK_S) { + setYDirection(0, 1); + } + + if (e.getKeyCode() == KeyEvent.VK_UP) { + setYDirection(0, 2); + } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { + setYDirection(0, 2); + } + move(); } - public void released(KeyEvent e) { + public void pressed (KeyEvent e) { if (e.getKeyCode() == KeyEvent.VK_W) { setYDirection(-speed, 1); } else if (e.getKeyCode() == KeyEvent.VK_S) { setYDirection(speed, 1); } - // Check if UP or DOWN key was pressed (for paddle 2) if (e.getKeyCode() == KeyEvent.VK_UP) { setYDirection(-speed, 2); } else if (e.getKeyCode() == KeyEvent.VK_DOWN) { diff --git a/src/main/java/PingPong/Score.java b/src/main/java/PingPong/Score.java index 6956bae..73b2ee1 100644 --- a/src/main/java/PingPong/Score.java +++ b/src/main/java/PingPong/Score.java @@ -9,6 +9,9 @@ public class Score extends Rectangle { public final int CENTER_DOT = 10; int player_1; int player_2; + + + public void draw(Graphics g) { g.setColor(Color.white); g.setFont(new Font("Consolas", Font.BOLD,50)); From b726727bdd6e9a6f6f783012f2b23d951012ac1a Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Wed, 8 Feb 2023 00:05:58 +0100 Subject: [PATCH 29/29] refactoring: --- src/main/java/PingPong/Ball.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/PingPong/Ball.java b/src/main/java/PingPong/Ball.java index bbc7809..6ccf4d9 100644 --- a/src/main/java/PingPong/Ball.java +++ b/src/main/java/PingPong/Ball.java @@ -44,7 +44,11 @@ Random random; y += yVelocity; } public void draw(Graphics g){ - g.setColor(Color.red); + Color(g); g.fillOval(x, y, width, height); } + + private static void Color(Graphics g) { + g.setColor(Color.red); + } }