D
Diveyoc
Guest
I'm trying to change what I know from a 1D array to a 2D array. It seems that this 1 command line is hanging me up.
button[c,r].slot = [c,r]; - (it won't accept this command)
button[c,r].slot = c; - (This was a test. When I pick up an item it fills the entire column)
button[c,r].slot = r; - (This was a test. When I pick up an item it fills the entire row)
_____________________________________________________________________________
//==== Create Event From Tutorial - 1D Array
for (i = 0; c < global.max_items; i += 1)
{
global.inventory[ i ] = -1;
button[ i ] = instance_create(0, 0, obj_invisible_button);
button[ i ].slot = i;
}
}
_____________________________________________________________________________
//==== My Code For 2D Array
for (c = 0; c < global.max_columns; c += 1)
{
for (r = 0; r < global.max_rows; r += 1)
{
global.inventory[c,r] = -1;
button[c,r] = instance_create(0, 0, obj_invisible_button);
button[c,r].slot = [c,r];
}
}
button[c,r].slot = [c,r]; - (it won't accept this command)
button[c,r].slot = c; - (This was a test. When I pick up an item it fills the entire column)
button[c,r].slot = r; - (This was a test. When I pick up an item it fills the entire row)
_____________________________________________________________________________
//==== Create Event From Tutorial - 1D Array
for (i = 0; c < global.max_items; i += 1)
{
global.inventory[ i ] = -1;
button[ i ] = instance_create(0, 0, obj_invisible_button);
button[ i ].slot = i;
}
}
_____________________________________________________________________________
//==== My Code For 2D Array
for (c = 0; c < global.max_columns; c += 1)
{
for (r = 0; r < global.max_rows; r += 1)
{
global.inventory[c,r] = -1;
button[c,r] = instance_create(0, 0, obj_invisible_button);
button[c,r].slot = [c,r];
}
}