diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml new file mode 100644 index 0000000..797acea --- /dev/null +++ b/.idea/runConfigurations.xml @@ -0,0 +1,10 @@ + + + + + + \ No newline at end of file diff --git a/Steine/I.txt b/Steine/I.txt new file mode 100644 index 0000000..19339a2 --- /dev/null +++ b/Steine/I.txt @@ -0,0 +1,16 @@ +0000 +1111 +0000 +0000 +0010 +0010 +0010 +0010 +0000 +0000 +1111 +0000 +0100 +0100 +0100 +0100 \ No newline at end of file diff --git a/Steine/J.txt b/Steine/J.txt new file mode 100644 index 0000000..220248d --- /dev/null +++ b/Steine/J.txt @@ -0,0 +1,12 @@ +100 +111 +000 +011 +010 +010 +000 +111 +001 +010 +010 +110 \ No newline at end of file diff --git a/Steine/L.txt b/Steine/L.txt new file mode 100644 index 0000000..a299305 --- /dev/null +++ b/Steine/L.txt @@ -0,0 +1,12 @@ +001 +111 +000 +010 +010 +011 +000 +111 +100 +110 +010 +010 \ No newline at end of file diff --git a/Steine/O.txt b/Steine/O.txt new file mode 100644 index 0000000..5ab665e --- /dev/null +++ b/Steine/O.txt @@ -0,0 +1,8 @@ +11 +11 +11 +11 +11 +11 +11 +11 \ No newline at end of file diff --git a/Steine/S.txt b/Steine/S.txt new file mode 100644 index 0000000..dda0620 --- /dev/null +++ b/Steine/S.txt @@ -0,0 +1,12 @@ +011 +110 +000 +010 +011 +001 +000 +011 +110 +100 +110 +010 \ No newline at end of file diff --git a/Steine/T.txt b/Steine/T.txt new file mode 100644 index 0000000..ef4709e --- /dev/null +++ b/Steine/T.txt @@ -0,0 +1,12 @@ +010 +111 +000 +011 +010 +000 +111 +010 +010 +110 +010 + diff --git a/Steine/Z.txt b/Steine/Z.txt new file mode 100644 index 0000000..e3b7b55 --- /dev/null +++ b/Steine/Z.txt @@ -0,0 +1,13 @@ +110 +011 +000 +001 +011 +010 +000 +110 +011 +010 +110 +100 + diff --git a/out/production/Tetris/Tetris/Board.class b/out/production/Tetris/Tetris/Board.class index 37d34ff..59105a7 100644 Binary files a/out/production/Tetris/Tetris/Board.class and b/out/production/Tetris/Tetris/Board.class differ diff --git a/out/production/Tetris/Tetris/GameGui.class b/out/production/Tetris/Tetris/GameGui.class index d445ac2..1aedb5f 100644 Binary files a/out/production/Tetris/Tetris/GameGui.class and b/out/production/Tetris/Tetris/GameGui.class differ diff --git a/src/Tetris/Board.java b/src/Tetris/Board.java index ce96f18..3b944d7 100644 --- a/src/Tetris/Board.java +++ b/src/Tetris/Board.java @@ -33,7 +33,7 @@ private Color[] colors ={Color.decode("#ff00bf"),Color.decode("#0000ff"),Color.d public Board() { ran = new Random(); - steine[0]= new Stein(new int[][]{ + /*steine[0]= new Stein(new int[][]{ {1,1,1}, {0,1,0} @@ -63,7 +63,7 @@ private Color[] colors ={Color.decode("#ff00bf"),Color.decode("#0000ff"),Color.d {1,1,1,1} }, this,colors[6]); - currenStein= steine[0]; + currenStein= steine[0];*/ loop = new Timer(delay, new ActionListener() { int n = 0; diff --git a/src/Tetris/Stein.java b/src/Tetris/Stein.java index 6e4fbfd..feea645 100644 --- a/src/Tetris/Stein.java +++ b/src/Tetris/Stein.java @@ -1,15 +1,21 @@ package Tetris; import java.awt.*; +import java.io.File; +import java.io.FileNotFoundException; +import java.util.Scanner; public class Stein { - private int x = 4, y = 0; + SteineTyp Block; + private int x = 4, y = -2; private int normal = 850; private int fast = 50; + private int rotation; private long beginTime; private int delayTime = normal; private int deltax = 0; private boolean collision = false; + private int size; public static final int BOARD_WIDTH = 11; public static final int BOARD_HEIGHT = 20; @@ -19,10 +25,70 @@ public class Stein { private Board board; private Color color; - public Stein(int[][] coords, Board board, Color color) { - this.coords = coords; + public Stein() { + /* this.coords = coords; this.board = board; - this.color = color; + this.color = color;*/ + //Ewen Kerbs still in progress + // Hier werden die verschiedene steine auf deren typ "analysiert" und dann ausgewertet wie viel platz die aufm spielbrett benötigen + Block = SteineTyp.randomSteine(); + switch (Block) + { + case I: + size = 4; + break; + case O: + size =2; + break; + default: + size =3; + break; + } + } + + //ewen Kerbs still in progress + public int[][][] BlockBuilder(SteineTyp type) throws FileNotFoundException { + int[][][] size; + switch(type) + { + case I: + /* 3 dimensionales array um die rotations zu erkennen + */ + size = new int[4][4][4]; + break; + case O: + size = new int[4][2][2]; + break; + default: + size = new int[4][3][3]; + break; + } + File file = new File("Steine/"+type+".txt"); + Scanner leser = new Scanner(file); + //i= 4 verschiedene stein varianten (1=0° 2=90° 3=180°4=270°) + for (int varianten = 0; varianten < 4 ; varianten++) { + for (int j = 0; j < size[0].length; j++) { + if(leser.hasNext()) + { + String[] srow = leser.next().split(""); + int[] row = new int[size[0].length]; + for (int k = 0; k