posted 11 years ago
To fill in the board square covered by a piece, it would be helpful to have a method similar to the one above that copies the non-zero entries from the given array into the corresponding board squares.
I need to implement this now, but I have the following questions:
where do I put the contents array? I don't see a board array in the program
do i need to put the contents array inside the board once it was laid down or once it appears? and how do i know a piece was laid down? what if statement should i use for that?
Code:
Code:
Code:
Code:
I don't know where the content of the board is stored, but I know that board extends grid and contains int[][]contents; however I used contents to rotate the pieces earlier, so I don't think that's where the pieces are saved.
Everything seems to indicate that int [][]contents contains both, but I don't understand the code.
Btw, this is a tetris game.
I also implemented the following code earlier, but I don't know what reference to pass in for the board variable.