if you're reading this, thank you.
I am trying to creating a Piece Constructor class for a Tetris game, the function of the class is choose an array from a specific number of pre-created arrays (those are pieces)
Here's my code
#include "PieceCreator.h"
int PCreator::colocarFicha()
{
int Pieces[6][5][5] =
{
{
{0,0,0,0,0},
{0,0,0,0,0},
{1,1,1,1,1},
{0,0,0,0,0},
{0,0,0,0,0}
},
{
{0,0,0,0,0},
{1,0,0,0,0},
{1,1,1,1,1},
{0,0,0,0,0},
{0,0,0,0,0}
},
{
{0,0,0,0,0},
{0,0,0,0,0},
{1,1,1,1,1},
{0,0,0,0,0},
{0,0,0,0,0}
},
{
{0,0,0,0,0},
{0,1,1,0,0},
{0,1,1,0,0},
{0,0,0,0,0},
{0,0,0,0,0}
},
{
{0,0,0,0,0},
{0,1,1,0,0},
{1,1,0,0,0},
{0,0,0,0,0},
{0,0,0,0,0}
},
{
{0,0,0,0,0},
{1,1,0,0,0},
{0,1,1,0,0},
{0,0,0,0,0},
{0,0,0,0,0}
}
};
srand((int) time(0));
int randNum = rand() % 5;
return Pieces[1];
}
what i'm trying to do is return the array of the position 2 in the array of arrays because i'll use this with another function, i don't know how to do that.
i know how to print an array but i don't know how to return the self array.