commit f2f9aaf1c78fc805cde3db8205a3a7a02284910b Author: agreiner Date: Mon Mar 22 10:07:15 2021 +0100 Praktikum 1 Abgabe diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 0000000..b780272 --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Datasource local storage ignored files +/../../../../../../:\Users\andre\IdeaProjects\Programmieren 2\.idea/dataSources/ +/dataSources.local.xml +# Editor-based HTTP Client requests +/httpRequests/ diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..b947fab --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..f620f5b --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/Programmieren 2.iml b/Programmieren 2.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/Programmieren 2.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..90dc4a3 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +Umsetzung des Panic Mode von Super Pang World in Java für den Kurs Programmierung II and der TH Deggendorf. \ No newline at end of file diff --git a/SuperPangWorld/SuperPangWorld.iml b/SuperPangWorld/SuperPangWorld.iml new file mode 100644 index 0000000..c90834f --- /dev/null +++ b/SuperPangWorld/SuperPangWorld.iml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/SuperPangWorld/src/superpangworld/Position.java b/SuperPangWorld/src/superpangworld/Position.java new file mode 100644 index 0000000..2695d75 --- /dev/null +++ b/SuperPangWorld/src/superpangworld/Position.java @@ -0,0 +1,57 @@ +package superpangworld; + +/** + * Die Position eines Objekts auf einem Fenster anhand zweidimensoinaler Koordinaten + */ +public class Position { + + /** Die x-Koordinate */ + public double x; + /** Die y-Koordinate */ + public double y; + + /** + * Erzeugt eine Position mit den übergebenen Koordinaten + * + * @param x die x-Koordinate des Objekts + * @param y die y-Koordinate des Objekts + */ + public Position(double x, double y) { + this.x = x; + this.y = y; + } + + /** + * Veränderung der Position um einen Pixel nach links + */ + public void left() { + x--; + } + + /** + * Veränderung der Position um einen Pixel nach rechts + */ + public void right() { + x++; + } + + /** + * Veränderung der Position um einen Pixel nach oben + */ + public void up() { + y--; + } + + /** + * Veränderung der Position um einen Pixel nach unten + */ + public void down() { + y++; + } + + @Override + public String toString() { + return "Position(" + (int) Math.round(x) + ", " + (int) Math.round(y) + ')'; + } + +} diff --git a/SuperPangWorld/src/superpangworld/Start.java b/SuperPangWorld/src/superpangworld/Start.java new file mode 100644 index 0000000..813e48b --- /dev/null +++ b/SuperPangWorld/src/superpangworld/Start.java @@ -0,0 +1,16 @@ +package superpangworld; + +public class Start { + public static void main(String[] args) { + System.out.println("Spiel"); + + Position pos1 = new Position(100, 110); + Position pos2 = new Position(200, 300); + + pos2.down(); + pos2.right(); + + System.out.println(pos1); + System.out.println(pos2); + } +} diff --git a/out/production/SuperPangWorld/superpangworld/Position.class b/out/production/SuperPangWorld/superpangworld/Position.class new file mode 100644 index 0000000..bf5bf77 Binary files /dev/null and b/out/production/SuperPangWorld/superpangworld/Position.class differ diff --git a/out/production/SuperPangWorld/superpangworld/Start.class b/out/production/SuperPangWorld/superpangworld/Start.class new file mode 100644 index 0000000..65013b4 Binary files /dev/null and b/out/production/SuperPangWorld/superpangworld/Start.class differ