Hi everyone!
I'm attempting to code my own version of tetris.
I'm having trouble creating a tetromino actor:
So I have a Tile class which represents just a single block.
Then I have a tetromino class which is the superclass for all tetrominos: (A Tetromino is just any configuration of 4 blocks)
In the constructor of the tetromino class, I attempt to construct an arrayList of Tiles.
Then, I have a subclass under this Tetromino class called "JTetro" that represents one configuration of the array of Tiles.
Here's the constructor for the JTetro class:
However, when I add a "JTetro" object to the world, it only adds a single Tile, not all four Tiles.
What am I doing wrong?
public Tetromino( int initialSpeed, int initialrotateCtr )
{
tiles = new Tile[4];
speed = initialSpeed;
rotateCtr = initialrotateCtr;
int index = 0;
while( index < tiles.length )
{
tiles[index] = new Tile();
index++;
}
}public JTetro( int initialSpeed, int initialrotateCtr )
{
super( initialSpeed, initialrotateCtr );
}
