0

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.

Davey - X
  • 23
  • 7
  • Hello, sorry but i think this is not like the other questions you linked here. – Davey - X May 18 '18 at 13:17
  • It is. What you are trying to do is not valid C++. The linked questions detail what you can change to get to valid C++ – Caleth May 18 '18 at 13:38

0 Answers0