Home>
I'd like to create a multi-dimensional array of presented codes with a class constructor initializer in creating a fallen puzzle game.
class Game :: Game (): gblock () ← This is the method of initialization.
{
}
/* Block type, rotation x, y * /
static const int gblock [8] [4] [4] [4]
{
/////////////////// 0
{
{
{1,1,1,1},
{0,0,0,0},
{0,0,0,0},
{0,0,0,0},
},
{
{0,0,0,1},
{0,0,0,1},
{0,0,0,1},
{0,0,0,1},
},
{
{1,1,1,1},
{0,0,0,0},
{0,0,0,0},
{0,0,0,0},
},
{
{0,0,1,0},
{0,0,1,0},
{0,0,1,0},
{0,0,1,0},
},
},
////////////////////////// 1
{
{
{1,1,0,0},
{1,1,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},
},
{
{1,1,0,0},
{1,1,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},
},
},
///////////////////////// 2
{
{
{0,1,1,0},
{1,1,0,0},
{0,0,0,0},
{0,0,0,0},
},
{
{1,0,0,0},
{1,1,0,0},
{0,1,0,0},
{0,0,0,0},
},
{
{0,1,1,0},
{1,1,0,0},
{0,0,0,0},
{0,0,0,0},
},
{
{1,0,0,0},
{1,1,0,0},
{0,1,0,0},
{0,0,0,0},
},
},
///////////////////////// 3
{
{
{1,1,0,0},
{0,1,1,0},
{0,0,0,0},
{0,0,0,0},
},
{
{0,1,0,0},
{1,1,0,0},
{1,0,0,0},
{0,0,0,0},
},
{
{1,1,0,0},
{0,1,1,0},
{0,0,0,0},
{0,0,0,0},
},
{
{0,1,0,0},
{1,1,0,0},
{1,0,0,0},
{0,0,0,0},
},
},
/////////////////////////Four
{
{
{1,0,0,0},
{1,1,1,0},
{0,0,0,0},
{0,0,0,0},
},
{
{1,1,0,0},
{1,0,0,0},
{1,0,0,0},
{0,0,0,0},
},
{
{1,1,1,0},
{0,0,1,0},
{0,0,0,0},
{0,0,0,0},
},
{
{0,1,0,0},
{0,1,0,0},
{1,1,0,0},
{0,0,0,0},
},
},
/////////////////////////Five
{
{
{0,0,1,0},
{1,1,1,0},
{0,0,0,0},
{0,0,0,0},
},
{
{1,0,0,0},
{1,0,0,0},
{1,1,0,0},
{0,0,0,0},
},
{
{1,1,1,0},
{1,0,0,0},
{0,0,0,0},
{0,0,0,0},
},
{
{1,1,0,0},
{0,1,0,0},
{0,1,0,0},
{0,0,0,0},
},
},
///////////////////////// 6
{
{
{0,1,0,0},
{1,1,1,0},
{0,0,0,0},
{0,0,0,0},
},
{
{1,0,0,0},
{1,1,0,0},
{1,0,0,0},
{0,0,0,0},
},
{
{1,1,1,0},
{0,1,0,0},
{0,0,0,0},
{0,0,0,0},
},
{
{0,1,0,0},
{1,1,0,0},
{0,1,0,0},
{0,0,0,0},
},
},
};
-
Answer # 1
Related articles
- c ++ - even if i put a value in the array obtained by the data () method of vector, size is not updated
- c ++ vector > type array cannot be created
- i want to create a 3d array with c ++ and convert it to an image
- c ++ - beginners want to know how to pass a 2d array as a function argument
- c ++ - i want to pass a vector by reference to an array what is a member function? begin ()?
- c ++ - no value is assigned to the array
- c ++ - how to set the texture of the model with dxlib there is no such function in the library
- c ++ - i want to output the subscript of the array of integers 5 in the integer array
- c ++ - read csv file and store in double array
- c ++ - is the i-th element of vector an array?
- c ++ - i want to get the number of elements of the array taken as the argument of the function
- c ++ - it's a two-dimensional array problem i don't know what to do
- c ++ - i am getting an error due to an array problem
- c ++ - how to add/delete array
- c ++ - how to use fopen_s (how to open with a string stored in an array)
- c ++ - i want to know how to use directx functions with dxlib
- c ++ - processing when adding to the array itself instead of the elements of the array
- c ++ - one-dimensional array/two-dimensional array sfinae judgment conditions such as vector and array
- about deleting c ++ structure array
- c ++ - inside the x and y array
Trends
If the array is just a member, you can write like the following Data,
If it is a static member, the initialization is written on the definition side like SCData below.