Im just new to Java and I found this good tutorial for creating a Java Tetris Game.
I dont have a mentor or a tutor to help me with this - Ive been looking for one for ages :( so currently im self learning Java and PHP :)
Anyways heres the website I found: http://zetcode.com/tutorials/javagamestutorial/tetris/
One method of the program I dont get in the Shape.java
class:
public Shape rotateLeft()
{
if (pieceShape == Tetrominoes.SquareShape)
return this;
Shape result = new Shape();
result.pieceShape = pieceShape;
for (int i = 0; i < 4; ++i) {
result.setX(i, y(i));
result.setY(i, -x(i));
}
return result;
}
Why do we need to create a new Object Shape result = new Shape();
if can already get the current piece from the pieceShape
variable?