I'm trying to make a map editor and have arrays for each axis X, Y & Z and also an array for attributes for the tile on that spesific slot.
The problem I have is that when I try to change a spesific slot in the arrays, then all the slots in the first 2 arrays gets changed.
This is how i created the 4D array (in object oRender):
var arrayAttributes = array_create(4, 0);
var arrayZ = array_create(MAP_D, arrayAttributes); //MAP_D = 4
var arrayY = array_create(MAP_H, arrayZ); //MAP_H = 11
map = array_create(MAP_W, arrayY); //MAP_W = 16
And this is how i try to change a spesific slot (from within oTileCreater):
if (mouse_check_button_pressed(mb_left))
{
oRender.map[gridX][gridY][gridZ][TILE.SPRITE] = blockType; //TILE is an enum and SPRITE = 0
}
I've also tried just changing all the variables to hardcoded numbers just to check if that had something to do with it, but i still get the same result.
The entire X & Y grid on the selected Z grid fills with the expected blocktype
The problem I have is that when I try to change a spesific slot in the arrays, then all the slots in the first 2 arrays gets changed.
This is how i created the 4D array (in object oRender):
var arrayAttributes = array_create(4, 0);
var arrayZ = array_create(MAP_D, arrayAttributes); //MAP_D = 4
var arrayY = array_create(MAP_H, arrayZ); //MAP_H = 11
map = array_create(MAP_W, arrayY); //MAP_W = 16
And this is how i try to change a spesific slot (from within oTileCreater):
if (mouse_check_button_pressed(mb_left))
{
oRender.map[gridX][gridY][gridZ][TILE.SPRITE] = blockType; //TILE is an enum and SPRITE = 0
}
I've also tried just changing all the variables to hardcoded numbers just to check if that had something to do with it, but i still get the same result.
The entire X & Y grid on the selected Z grid fills with the expected blocktype