From 9ced6908967e2ea3076283c73b283868ea4d3c97 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Tue, 31 Jan 2023 16:16:01 +0100 Subject: [PATCH 1/5] Update --- src/main/java/GamePanel.java | 2 ++ src/main/java/MenuPanel.java | 12 +++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) create mode 100644 src/main/java/GamePanel.java diff --git a/src/main/java/GamePanel.java b/src/main/java/GamePanel.java new file mode 100644 index 0000000..3311fd3 --- /dev/null +++ b/src/main/java/GamePanel.java @@ -0,0 +1,2 @@ +public class GamePanel { +} diff --git a/src/main/java/MenuPanel.java b/src/main/java/MenuPanel.java index 0fa2ec8..15aed4d 100644 --- a/src/main/java/MenuPanel.java +++ b/src/main/java/MenuPanel.java @@ -1,2 +1,12 @@ -public class MenuPanel { +import javax.swing.*; +import java.awt.*; + + +public class MenuPanel extends JPanel { + + MenuPanel() { + this.addKeyListener(new MenuPanel.AL()); + this.setBackground(Color.BLACK); + this.setFocusable(true); + this.setPreferredSize(GamePanel.SCREEN); } From bbda0cb606f1177995c169420cf3ae96991cf8cc Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Mon, 6 Feb 2023 01:44:46 +0100 Subject: [PATCH 2/5] initial commit --- team.md | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 team.md diff --git a/team.md b/team.md new file mode 100644 index 0000000..63b6a43 --- /dev/null +++ b/team.md @@ -0,0 +1,2 @@ +-BerkanSarp, fdai4616 +-berkan.sarp@informatik.hs-fulda.de \ No newline at end of file From 6f10b5d2e6f86347e30e9a7e3a4ad97bf3eb19b8 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Mon, 6 Feb 2023 14:32:20 +0100 Subject: [PATCH 3/5] update --- .../java/build-project.sh => build-project.sh | 0 src/main/java/MenuPanel.java | 24 ++++++++++++++++++- src/main/java/{ => PingPong}/Ball.java | 2 ++ src/main/java/{ => PingPong}/GameFrame.java | 4 ++++ src/main/java/{ => PingPong}/GamePanel.java | 2 ++ src/main/java/{ => PingPong}/Paddle.java | 2 ++ src/main/java/{ => PingPong}/Score.java | 2 ++ 7 files changed, 35 insertions(+), 1 deletion(-) rename src/main/java/build-project.sh => build-project.sh (100%) rename src/main/java/{ => PingPong}/Ball.java (53%) rename src/main/java/{ => PingPong}/GameFrame.java (94%) rename src/main/java/{ => PingPong}/GamePanel.java (58%) rename src/main/java/{ => PingPong}/Paddle.java (55%) rename src/main/java/{ => PingPong}/Score.java (54%) diff --git a/src/main/java/build-project.sh b/build-project.sh similarity index 100% rename from src/main/java/build-project.sh rename to build-project.sh diff --git a/src/main/java/MenuPanel.java b/src/main/java/MenuPanel.java index 15aed4d..709c4a7 100644 --- a/src/main/java/MenuPanel.java +++ b/src/main/java/MenuPanel.java @@ -1,5 +1,8 @@ +import PingPong.GamePanel; + import javax.swing.*; import java.awt.*; +import java.awt.event.KeyListener; public class MenuPanel extends JPanel { @@ -9,4 +12,23 @@ public class MenuPanel extends JPanel { this.setBackground(Color.BLACK); this.setFocusable(true); this.setPreferredSize(GamePanel.SCREEN); -} + } + + protected void paintComponent(Graphics g) { + super.paintComponent(g); + draw(g); + } + public void draw(Graphics g) { + g.setColor(Color.WHITE); + g.setFont(new Font("Consolas", Font.BOLD, 70)); + g.drawString("GAME MENU", 330, 100); + g.setFont(new Font("Consolas", Font.BOLD, 30)); + g.drawString("Press 'ENTER' to start the game", 265, 200); + g.setFont(new Font("Consolas", Font.PLAIN, 10)); + g.drawString("Created by Hells Gamers", 450, 450); + + } + + public class AL implements KeyListener { + } +} \ No newline at end of file diff --git a/src/main/java/Ball.java b/src/main/java/PingPong/Ball.java similarity index 53% rename from src/main/java/Ball.java rename to src/main/java/PingPong/Ball.java index f1f843c..9fe0189 100644 --- a/src/main/java/Ball.java +++ b/src/main/java/PingPong/Ball.java @@ -1,2 +1,4 @@ +package PingPong; + public class Ball { } diff --git a/src/main/java/GameFrame.java b/src/main/java/PingPong/GameFrame.java similarity index 94% rename from src/main/java/GameFrame.java rename to src/main/java/PingPong/GameFrame.java index b6813fb..5cb7cf2 100644 --- a/src/main/java/GameFrame.java +++ b/src/main/java/PingPong/GameFrame.java @@ -1,3 +1,5 @@ +package PingPong; + import javax.swing.*; import java.awt.*; @@ -16,4 +18,6 @@ public class GameFrame extends JFrame { } + } + } diff --git a/src/main/java/GamePanel.java b/src/main/java/PingPong/GamePanel.java similarity index 58% rename from src/main/java/GamePanel.java rename to src/main/java/PingPong/GamePanel.java index 3311fd3..22a2aee 100644 --- a/src/main/java/GamePanel.java +++ b/src/main/java/PingPong/GamePanel.java @@ -1,2 +1,4 @@ +package PingPong; + public class GamePanel { } diff --git a/src/main/java/Paddle.java b/src/main/java/PingPong/Paddle.java similarity index 55% rename from src/main/java/Paddle.java rename to src/main/java/PingPong/Paddle.java index 942d2bd..c1483f2 100644 --- a/src/main/java/Paddle.java +++ b/src/main/java/PingPong/Paddle.java @@ -1,2 +1,4 @@ +package PingPong; + public class Paddle { } diff --git a/src/main/java/Score.java b/src/main/java/PingPong/Score.java similarity index 54% rename from src/main/java/Score.java rename to src/main/java/PingPong/Score.java index e188430..10a75ce 100644 --- a/src/main/java/Score.java +++ b/src/main/java/PingPong/Score.java @@ -1,2 +1,4 @@ +package PingPong; + public class Score { } From fa499aa3c2ef6a0d4cbcefbe19fd368ab385a735 Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Mon, 6 Feb 2023 14:32:35 +0100 Subject: [PATCH 4/5] update --- target/classes/Ball.class | Bin 0 -> 237 bytes target/classes/GameFrame.class | Bin 0 -> 846 bytes target/classes/GamePanel.class | Bin 0 -> 252 bytes target/classes/Main.class | Bin 0 -> 387 bytes target/classes/MenuFrame.class | Bin 0 -> 711 bytes 5 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 target/classes/Ball.class create mode 100644 target/classes/GameFrame.class create mode 100644 target/classes/GamePanel.class create mode 100644 target/classes/Main.class create mode 100644 target/classes/MenuFrame.class diff --git a/target/classes/Ball.class b/target/classes/Ball.class new file mode 100644 index 0000000000000000000000000000000000000000..ba843c48044c1b1bafbdee026c0aae3b5a2dc2be GIT binary patch literal 237 zcmXYrO%8%E5QSg)5kVB<4cw^9q6tzTN%-+82XagO$BF0z`Tvyg?XR}AKOk~ruxSZl5nrA>Jf z3_&alv1_iWsE#~UM22yhah32&YX65;eUUeME!M+x2JcWdRVKDlPq-S+^xqi4p_TMu k6tonnOD<|XU{9Z54*~`}Qr*^9d!&9_+m!n)8;}|ZerrD}H~;_u literal 0 HcmV?d00001 diff --git a/target/classes/GameFrame.class b/target/classes/GameFrame.class new file mode 100644 index 0000000000000000000000000000000000000000..10e34ca7ab0552e36b556f5f78399fd53268339a GIT binary patch literal 846 zcmY*XX>Zd&5PjRYP2z5jrbo)rlglwQhL$@4siaC26qTrrB9(7$vIK);N4C=<{s}(= z2^ArP=Q@WVL_NrEUt#41D)svrRH~+O9K@kRrz_E-|Eh5p=A;CS}W7OA0n@ljI%; z9+g*0U0HmE<0{sOg^G`aZ+$dRB|y<$OA8y+G6I_Cfl+g9*Hf{MEjfg3@~btQ%_+@w zjvKhikRh5EX7ByLbH@$|UW^-G;N!L$M+rK^D%Br|H|E$5YPRc(S0mw>f#o_2o1&=^<|GN{F(~LfrctHF!whGBpN~D|GvENTG-{)}UgW;(OqD zj0~zIX`ixnEZ`AU^GIfca!(>2x_+@tDK)b3w}Es3EJeVT*y9u^-Ab>Fo~IG8@*Bb* BqVSxGE>fR7S$8|h4PX3m*M z&gc7j1DL{hVW8%~Y{7y}@Xz8df<&apU>%)hToCMuN>wo<)cS+HgF2zH6c@P>sZ0pw zJUd82Cse6i-7b;LcOpty>4sS>lD){4=6}&FPU=c%hSi5L!QE!JJeCWk&%A0f(pJ!e o!wz*2CwpXUFbhf!Si>ji!GZyoQIGX%ld)Cy7T0#Ed5i`+KMe~o6aWAK literal 0 HcmV?d00001 diff --git a/target/classes/Main.class b/target/classes/Main.class new file mode 100644 index 0000000000000000000000000000000000000000..ac732a91a195eec1b7fc57e9c65486a3ad452955 GIT binary patch literal 387 zcmZusu};G<6g($sQ-?rH3uR_&8OX>`U_t7X!cY{1n4Dk*SBWE;r2oZK2_!y%k3u}B zNM*p1@9EvWyJvrWzkdR_!bt!Jt`9Fn2VI82N~}dx2%SfF=}KlbL-$f?RbMl>lWF3k z$G{g-H*+IO8Nj#hJqB+fl%{f1JxhjuthBss%2b+rkru=Z<0=zHB8;;AFX`1U>XkOc z);uG3*@lcKPx0;@%i1WN&!!3K!sIkR`bTC6mQ`aiIahWaw~6OA1gEfnw8sInza$K) zi>NZHowE(tTPyDqS{ZZ?2*d3F`WR5hafl%?)_l>15%&TAaRdIa3)pUR(S!FVgkyxG KHu#v(!T1NEm_#N3 literal 0 HcmV?d00001 diff --git a/target/classes/MenuFrame.class b/target/classes/MenuFrame.class new file mode 100644 index 0000000000000000000000000000000000000000..8ba9826661a9c41346c69f650e32d96a0fddfe59 GIT binary patch literal 711 zcmZuv%Wl&^6g?BWapF#2fztA7Q_3S5+M0(1ivXLTN}v>?HZp?UG?|tGXB^p1i`er) zNZ?8!@d11k;*Jwob>Z>cd(J)gG57bMAHM)R#X}z@I38S%8I&1nALNPr6r`ux90xCV z6FF22=}d8Xoemt4Anhl#$9PtL5#q-fD)He3j!Gt}}2V@2gaQmWMXLZM>V{>l}4#Fsu^( zTph`Al(nNcRj)@Xk(rK-<-VA3H#u(F8M-6c|7gW;bKJ4wJ_Uz5)g*1*O%8#(R28{9 zaleq+R}uYBR4=CH&L2id%I$bS)h%?iQLo0sLzVO<_13IT6v{+fd+Kzv_d5MI`QkZR zRLem;PWozB+cxLz1Pf%xjvpITU5WOB(MK;?+?ZVq@@$dy1x|rI7H44MC%m_3sD6hp z#5edk7T<{4#T=J}ljDjg=U5XtZU{HWEx~d$zLG=<+jI)}bkf?PLTRe>U_RC;`6lMj cpwwIBy^lpa!V-3f$tP(M;2v3wFst<7FXt4Pu>b%7 literal 0 HcmV?d00001 From 70a26f91fe8a049ec5baa34926f91f6c98ad005a Mon Sep 17 00:00:00 2001 From: fdai4616 Date: Mon, 6 Feb 2023 14:50:06 +0100 Subject: [PATCH 5/5] update --- .idea/uiDesigner.xml | 124 +++++++++++++++++++++++ src/main/java/MenuPanel.java | 14 ++- src/main/java/PingPong/GameFrame.java | 2 - src/main/java/PingPong/GamePanel.java | 16 ++- target/classes/Ball.class | Bin 237 -> 0 bytes target/classes/GameFrame.class | Bin 846 -> 0 bytes target/classes/GamePanel.class | Bin 252 -> 0 bytes target/classes/MenuPanel$AL.class | Bin 0 -> 720 bytes target/classes/MenuPanel$GameFrame.class | Bin 0 -> 412 bytes target/classes/MenuPanel.class | Bin 0 -> 1417 bytes target/classes/PingPong/GameFrame.class | Bin 0 -> 844 bytes target/classes/Snake/Apple.class | Bin 0 -> 252 bytes 12 files changed, 152 insertions(+), 4 deletions(-) create mode 100644 .idea/uiDesigner.xml delete mode 100644 target/classes/Ball.class delete mode 100644 target/classes/GameFrame.class delete mode 100644 target/classes/GamePanel.class create mode 100644 target/classes/MenuPanel$AL.class create mode 100644 target/classes/MenuPanel$GameFrame.class create mode 100644 target/classes/MenuPanel.class create mode 100644 target/classes/PingPong/GameFrame.class create mode 100644 target/classes/Snake/Apple.class diff --git a/.idea/uiDesigner.xml b/.idea/uiDesigner.xml new file mode 100644 index 0000000..2b63946 --- /dev/null +++ b/.idea/uiDesigner.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/src/main/java/MenuPanel.java b/src/main/java/MenuPanel.java index 709c4a7..098f221 100644 --- a/src/main/java/MenuPanel.java +++ b/src/main/java/MenuPanel.java @@ -2,6 +2,8 @@ import PingPong.GamePanel; import javax.swing.*; import java.awt.*; +import java.awt.event.KeyAdapter; +import java.awt.event.KeyEvent; import java.awt.event.KeyListener; @@ -29,6 +31,16 @@ public class MenuPanel extends JPanel { } - public class AL implements KeyListener { + public class AL extends KeyAdapter { + + public void keyPressed(KeyEvent e) { + if (e.getKeyCode() == KeyEvent.VK_1) { + new GameFrame(); + + } +} + } + + private class GameFrame { } } \ No newline at end of file diff --git a/src/main/java/PingPong/GameFrame.java b/src/main/java/PingPong/GameFrame.java index 5cb7cf2..6f87f8e 100644 --- a/src/main/java/PingPong/GameFrame.java +++ b/src/main/java/PingPong/GameFrame.java @@ -18,6 +18,4 @@ public class GameFrame extends JFrame { } - } - } diff --git a/src/main/java/PingPong/GamePanel.java b/src/main/java/PingPong/GamePanel.java index 22a2aee..89ff717 100644 --- a/src/main/java/PingPong/GamePanel.java +++ b/src/main/java/PingPong/GamePanel.java @@ -1,4 +1,18 @@ package PingPong; -public class GamePanel { +import javax.swing.*; +import java.awt.*; + +public class GamePanel extends JPanel implements Runnable { + static final int FRAME_WIDTH = 1000; + static final int FRAME_HEIGHT = (int) (FRAME_WIDTH * 0.5); + static final int BALL_DIAMETER = 26; + static final int PADDLE_WIDTH = 25; + static final int PADDLE_HEIGHT = 100; + public static final Dimension SCREEN = new Dimension(FRAME_WIDTH, FRAME_HEIGHT); + + + public void run() { + + } } diff --git a/target/classes/Ball.class b/target/classes/Ball.class deleted file mode 100644 index ba843c48044c1b1bafbdee026c0aae3b5a2dc2be..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 237 zcmXYrO%8%E5QSg)5kVB<4cw^9q6tzTN%-+82XagO$BF0z`Tvyg?XR}AKOk~ruxSZl5nrA>Jf z3_&alv1_iWsE#~UM22yhah32&YX65;eUUeME!M+x2JcWdRVKDlPq-S+^xqi4p_TMu k6tonnOD<|XU{9Z54*~`}Qr*^9d!&9_+m!n)8;}|ZerrD}H~;_u diff --git a/target/classes/GameFrame.class b/target/classes/GameFrame.class deleted file mode 100644 index 10e34ca7ab0552e36b556f5f78399fd53268339a..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 846 zcmY*XX>Zd&5PjRYP2z5jrbo)rlglwQhL$@4siaC26qTrrB9(7$vIK);N4C=<{s}(= z2^ArP=Q@WVL_NrEUt#41D)svrRH~+O9K@kRrz_E-|Eh5p=A;CS}W7OA0n@ljI%; z9+g*0U0HmE<0{sOg^G`aZ+$dRB|y<$OA8y+G6I_Cfl+g9*Hf{MEjfg3@~btQ%_+@w zjvKhikRh5EX7ByLbH@$|UW^-G;N!L$M+rK^D%Br|H|E$5YPRc(S0mw>f#o_2o1&=^<|GN{F(~LfrctHF!whGBpN~D|GvENTG-{)}UgW;(OqD zj0~zIX`ixnEZ`AU^GIfca!(>2x_+@tDK)b3w}Es3EJeVT*y9u^-Ab>Fo~IG8@*Bb* BqVSxGE>fR7S$8|h4PX3m*M z&gc7j1DL{hVW8%~Y{7y}@Xz8df<&apU>%)hToCMuN>wo<)cS+HgF2zH6c@P>sZ0pw zJUd82Cse6i-7b;LcOpty>4sS>lD){4=6}&FPU=c%hSi5L!QE!JJeCWk&%A0f(pJ!e o!wz*2CwpXUFbhf!Si>ji!GZyoQIGX%ld)Cy7T0#Ed5i`+KMe~o6aWAK diff --git a/target/classes/MenuPanel$AL.class b/target/classes/MenuPanel$AL.class new file mode 100644 index 0000000000000000000000000000000000000000..bbbd61b07ed8b6073b45334a96304db06de549c8 GIT binary patch literal 720 zcmZ{hVNVl55Qg8m)?V*8+S=NyRaC%&ZAq+tu96TUN<0V&ro{MZX(xJ8uHhA{-m8hdFqJ=4W-Pdg_br@hL~T_m361~zUKs$v{m5D z@|S>e5JtQ^JwD|4ojM!~vKmZ=YCKSJXzJN!-aJ((R}lGuzL+`Uv%Q#;ghzyhc5s91 zzPXVE-n>yknBUiGc(kKVW_P;#lW9EUtiMFvyaI#~W(smSa zyg63lN<3R;R8ICOSdy6*WxQ0Wn5oLjf{YLiiFc)1m)er-cGrG@y63RJrJAP1f@pwc z+>_{Es&F3*Qi(pL$usc)4`-|o$fYWO?I-3d&%dJl8@2b{@1S$k4-7X4!!1b$R^VV2 rb#$)r{fzJ95f+8Jly*^FT9##L;W1iiUcnQ|RoSrw)fQ<@atGE07g&zI literal 0 HcmV?d00001 diff --git a/target/classes/MenuPanel$GameFrame.class b/target/classes/MenuPanel$GameFrame.class new file mode 100644 index 0000000000000000000000000000000000000000..3799f3125af7cc8cac6519b7eae591124aeacba7 GIT binary patch literal 412 zcmYjNyH3ME5S+D5{D^T(Lc*h>ND%@e6m$WaNCBh}kU;4#<^+zMv*ZW=MS+kg_y9f% zu@@nSW@cyhcC@$OKc8O!F0k*yfN8_>v4I+)bt_eQFO*EWS7Is083UnKyu^9;lu(~k z{hae8ACD>*Hf zbD2GgdBRR}l13t#i7eLo&$RRsg!VdQz2cDIJ)~t8$#JX$f@;kZy%xcl%DlKv^TNgs z!L8Z^|3)d9jS`XPlH=X#+c@CUID91vLwy`wu~Ww;bHM71mBH-wkKRH357=+43^W*P i{02Bi$mp+X4_j!mGSOl*u#NVLJJ@CRR@oiw!T1H$u~Z}g literal 0 HcmV?d00001 diff --git a/target/classes/MenuPanel.class b/target/classes/MenuPanel.class new file mode 100644 index 0000000000000000000000000000000000000000..8ee37daa42a3335c658de8d3fd692d590e31f6d1 GIT binary patch literal 1417 zcmYjR-%}cA6g?kc7H~x%MiY~mt+5rM4Q<-AO-W3V0HQ#s7_Hiu6~5}Wxa;gLvFX3m zr{)1?nwdWIDbqiy)ARA0f!(`%?>+b2bMME$|NZqhfamxriU5KdLONz}Lm>H!`NsS$ z>s?v)S$3yk+Oi{XvZk5z|ES~ zi=NU~;OuUM=LEKJzEv@WFWS&rRj zw5}tC4bo+WhAV%Tt}EM3>vvXJnj$qxQp5tt==c<$vHeTavi*W{ap~C9N?>s+sqC7U z=T^%bP9Uq}bCnZnyXKXW@v)9Cm4-8i+m-!d6i@KAhHrFyt0YQ{g&n~Ngh{e5kB09k z;y9w@*nSw#7*KF*&*_+66i>0Kmf^*ukB&)kn!Zb&a+Qke;|cOQwonkz`U0y4l2Z*R zT#^r?$fYUgYel10tiM)yWgXiJJF0paV1}{7?V*OAXRH_N`^CL=!*>kNH(lTG&!ut3 zxr9+Ap@J(-U$%|Yx5l>YbUZ_i%=IWu!D&>QY`rJjc` zL;ktNq}i!m7Z7J$r^&QO;^oM->2%$eELm!WV&gOLNXbZ)y7c^-R5d*fKN4gdv8L#i zTwb_|6`RMTK#4uc+JQX#iH!YR$vJL^`ULsoS%yH3)+s`?fVK2BMEX6nBN~w&^z=I< zd$^qr^>B~2(ZeTyGA@8RuglB_bmq?SaRY{0Q0v{&6U_3hV?Iy%O{L(iexr#7L-R7U# z9rnG9Roum6cE5@H)Mf?8Fs6u~jESENi3hRI`~Y6#fOkdwkXT2wle9G|dd#*Cc|Sqm Ee|+XHmH+?% literal 0 HcmV?d00001 diff --git a/target/classes/PingPong/GameFrame.class b/target/classes/PingPong/GameFrame.class new file mode 100644 index 0000000000000000000000000000000000000000..bf5657e7bb0dba9d6a6217c6f5eaf0a3d1448a1f GIT binary patch literal 844 zcmZuv>rN9v6#k}NdReBWv>c9@MC9Z&iT%FzH|BY`}sT`pLp%wCV+;v~{CjyUKU%?w?H*Y# zw|v=E42d<{wZj(-@nWf!M2cVy@;5xfY!jj(UFDcaBA&)LcoG?oEGGVkjo8L|8qP3P zKTlFIiC~f=j{;?roeqO2*0m-}o`hD_>-IcXxnZSrkuim72EMYnpoy2YJWV&lF^kI# zsX&EIJ9Ma^=@F+Rse=8`CwQgQ(%`Ec*KnO!2)w5P`;$D>0Y>qSu6&*$`;QpM^G(cQ zQTOf!wW(OE)lO+{a@@jgh78ec$o7XL-|M?nOyNv16hBH^3p2XWB9i41y*>|bz>XMzi62NF43Pc?Q;4rHBjjF- z{8WTXA|Bxix#tdY^SRxeHNZlIC6S15M?|LPB=$XH|MmmIJM573