So I'm supposed to make a Tetris game but I don't make any progress.
1: The Tetrominos don't fall.
2: The Tetrominos can go through each other or rather don't stop moving when touching each other.
3: What I tried to do is make one block class form various Tetrominos. I failed.
Here's my attempt:
World class
Block class
Any help is highly appreciated :)
Counter counter = new Counter();
int[][]line = {{1,1,1,1},
{0,0,0,0},
{0,0,0,0},
{0,0,0,0}};
int[][]thunder = {{1,1,0,0},
{0,0,1,1},
{0,0,0,0},
{0,0,0,0}};
int[][]pyramid = {{0,1,0,0},
{1,1,1,0},
{0,0,0,0},
{0,0,0,0}};
public MyWorld()
{
super(15, 20, 40);
addObject(new Ground(), 5, 18);
create();
}
public void create()
{
createTetromino(line, Greenfoot.getRandomNumber(15), Greenfoot.getRandomNumber(3));
createTetromino(pyramid, Greenfoot.getRandomNumber(15), Greenfoot.getRandomNumber(3));
createTetromino(thunder, Greenfoot.getRandomNumber(15), Greenfoot.getRandomNumber(3));
}
public void createTetromino(int[][] tetromino, int x, int y)
{
Block[] block = {new Block(), new Block(), new Block(), new Block()};
int counter = 0;
for(int a = 0; a < 5; a = a + 1)
{
for(int b = 0; b < 5; b = b + 1)
{
if(tetromino[a][b] == 1)
{
addObject(new Block(),x, y);
counter++;
}
}
}
}
int vSpeed = 0;
public void act()
{
fall();
if(isTouching(Ground.class))
{
stopFalling();
}
if(isTouching(Block.class))
{
stopFalling();
}
}
public void fall()
{
vSpeed = vSpeed + 1;
}
public void stopFalling()
{
vSpeed = 0;
}



What is supposed to be in the gameOver() method btw? Greenfoot.stop()?