Ok, so I've read allot about this problem but still cant figure it out.
Basically Im making a Tetris game, I have a function 'getRandomPiece()' which I would like to return a random Tetris piece which is a 2d array. Problem is, not all pieces are the same dimensions (same width and height).
So after allot of reading it seems c++ cant return an array.
So then ill try passing a pointer to store the array. The problem with this is c++ wants me to declare the size of the array in the parameter which I dont know what its going to be yet.
Ideally in Java I can just go
Which is the best way to solve this problem?Code:int[][] getRandomPiece(){ //Random logic int[][] arr = {{1,1,0}, {0,1,1}}; return arr; }



LinkBack URL
About LinkBacks


