From da1d2571d625e2816328f68b86478961bc2dba25 Mon Sep 17 00:00:00 2001 From: 3009594 Date: Thu, 19 Sep 2024 17:36:13 +0200 Subject: [PATCH] test --- .../src/Übungen/Flappy_Bird/GamePanel.java | 25 +++++++++++++++--- .../src/Übungen/Flappy_Bird/bottompipe.png | Bin 0 -> 13924 bytes .../src/Übungen/Flappy_Bird/toppipe.png | Bin 0 -> 13787 bytes 3 files changed, 22 insertions(+), 3 deletions(-) create mode 100644 Programmierung2/src/Übungen/Flappy_Bird/bottompipe.png create mode 100644 Programmierung2/src/Übungen/Flappy_Bird/toppipe.png diff --git a/Programmierung2/src/Übungen/Flappy_Bird/GamePanel.java b/Programmierung2/src/Übungen/Flappy_Bird/GamePanel.java index 359e056..234d4dd 100644 --- a/Programmierung2/src/Übungen/Flappy_Bird/GamePanel.java +++ b/Programmierung2/src/Übungen/Flappy_Bird/GamePanel.java @@ -8,12 +8,13 @@ import javax.swing.*; public class GamePanel extends JPanel implements Runnable { final static int WIDTH_WINDOW = 600; - final static int HEIGH_WINDOW = 900; + final static int HEIGH_WINDOW = 800; Dimension fensterSize = new Dimension(WIDTH_WINDOW, HEIGH_WINDOW); DrawImages world; DrawImages flappy; DrawImages ground1,ground2; + DrawImages bottompipe,toppipe; Thread game; @@ -32,6 +33,11 @@ public class GamePanel extends JPanel implements Runnable { public void drawImage() { world = new DrawImages(0, 0, WIDTH_WINDOW, HEIGH_WINDOW, new ImageIcon("C:\\Users\\obaya\\git\\Programmierung2\\Programmierung2\\src\\Übungen\\Flappy_Bird\\world.png").getImage()); flappy = new DrawImages(50, HEIGH_WINDOW / 2, 50, 50, new ImageIcon("C:\\Users\\obaya\\git\\Programmierung2\\Programmierung2\\src\\Übungen\\Flappy_Bird\\flappy Bird.png").getImage()); + + + toppipe = new DrawImages(WIDTH_WINDOW/2,0,40,HEIGH_WINDOW - 300,new ImageIcon("C:\\Users\\obaya\\git\\Programmierung2\\Programmierung2\\src\\Übungen\\Flappy_Bird\\toppipe.png").getImage()); + bottompipe = new DrawImages(WIDTH_WINDOW/2,HEIGH_WINDOW - 200,40,300,new ImageIcon("C:\\Users\\obaya\\git\\Programmierung2\\Programmierung2\\src\\Übungen\\Flappy_Bird\\bottompipe.png").getImage()); + // Zwei Bodenbilder nebeneinander zeichnen ground1 = new DrawImages(0, HEIGH_WINDOW - 100, WIDTH_WINDOW, 200, new ImageIcon("C:\\Users\\obaya\\git\\Programmierung2\\Programmierung2\\src\\Übungen\\Flappy_Bird\\ground.png").getImage()); ground2 = new DrawImages(WIDTH_WINDOW, HEIGH_WINDOW - 100, WIDTH_WINDOW, 200, new ImageIcon("C:\\Users\\obaya\\git\\Programmierung2\\Programmierung2\\src\\Übungen\\Flappy_Bird\\ground.png").getImage()); @@ -41,13 +47,16 @@ public class GamePanel extends JPanel implements Runnable { super.paint(g); world.draw(g); flappy.draw(g); + toppipe.draw(g); + bottompipe.draw(g); ground1.draw(g); - ground2.draw(g); - } + ground2.draw(g); + } public void move() { flappy.move(); move_ground(); + move_pips(); } public void move_ground() { @@ -65,9 +74,19 @@ public class GamePanel extends JPanel implements Runnable { } } + public void move_pips() { + toppipe.x -= 1; + bottompipe.x -= 1; + } + public void checkKollision() { if(flappy.intersects(ground1)) gameOver = true; + + if (flappy.intersects(toppipe)) + gameOver = true; + + } diff --git a/Programmierung2/src/Übungen/Flappy_Bird/bottompipe.png b/Programmierung2/src/Übungen/Flappy_Bird/bottompipe.png new file mode 100644 index 0000000000000000000000000000000000000000..2c57b32ab1b1556d0c3dff85140856b836a2be6c GIT binary patch literal 13924 zcmeI3Ye-XJ7{{M;a;7b12@Q#$QFeh?_X{!7DO0nHSp-p%*~P5bSYl)v>QDj&VSOlq zuqHy~mo!Z#BzcT3v%)P4s&RA+B{g)j;iWmxJiYUBB1YT#)R*VOcsV<4@7Z&EfA9Z! zSDBHX8ntNIA^?a=+oL)RKQRJ?BCcRM+YpaTLrtCK}oXfO=A5T~Tr>Dm)>tQnulGOl*0u5}YGGW@K zEwxdb-s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