stand vor dem 20.1
This commit is contained in:
		@@ -22,7 +22,7 @@ public class Board extends JPanel implements KeyListener
 | 
			
		||||
 | 
			
		||||
  private Timer loop;
 | 
			
		||||
  private Color[][] board = new Color[BOARD_HEIGHT][BOARD_WIDTH];
 | 
			
		||||
  private Stein [] steine=new Stein[7];
 | 
			
		||||
  private Stein [] steine=new Stein[6];
 | 
			
		||||
  private Stein currenStein;
 | 
			
		||||
  private Random ran;
 | 
			
		||||
 | 
			
		||||
@@ -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;
 | 
			
		||||
 
 | 
			
		||||
@@ -1,13 +1,9 @@
 | 
			
		||||
package Tetris;
 | 
			
		||||
 | 
			
		||||
import java.awt.*;
 | 
			
		||||
import java.io.File;
 | 
			
		||||
import java.io.FileNotFoundException;
 | 
			
		||||
import java.util.Scanner;
 | 
			
		||||
 | 
			
		||||
public class Stein {
 | 
			
		||||
    SteineTyp Block;
 | 
			
		||||
    private int x = 4, y = -2;
 | 
			
		||||
    private int x = 4, y = 0;
 | 
			
		||||
    private int normal = 850;
 | 
			
		||||
    private int fast = 50;
 | 
			
		||||
    private int rotation;
 | 
			
		||||
@@ -15,7 +11,6 @@ public class Stein {
 | 
			
		||||
    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;
 | 
			
		||||
@@ -25,61 +20,10 @@ public class Stein {
 | 
			
		||||
    private Board board;
 | 
			
		||||
    private Color color;
 | 
			
		||||
 | 
			
		||||
    public Stein() {
 | 
			
		||||
       /* this.coords = coords;
 | 
			
		||||
    public Stein(int[][] coords, Board board, Color color) {
 | 
			
		||||
        this.coords = coords;
 | 
			
		||||
        this.board = board;
 | 
			
		||||
        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 <row.length; k++)
 | 
			
		||||
                    {
 | 
			
		||||
                        row[j]= Integer.valueOf(srow[j]);
 | 
			
		||||
                        size[varianten][j][k] =row[j];
 | 
			
		||||
                    }
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        return size;
 | 
			
		||||
        this.color = color;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    public void rotate()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user