Hi there. I am using a ds_map in order to store a number of ds_grids. The idea is that groups of objects fill out their own shared grid as you collect them, and when you have collected every object within a group, it uses the grid to create a number of jigsaw pieces, then destroys the ds_grid.
The code works fine when I test it as a Windows program. However, when I test it as an HTML5 game, it doesn't seem to fill the grids with anything. It doesn't even clear the grid, since it starts generating jigsaw pieces straight away, but with no data in them.
Any help appreciated. Code is as follows:
The code works fine when I test it as a Windows program. However, when I test it as an HTML5 game, it doesn't seem to fill the grids with anything. It doesn't even clear the grid, since it starts generating jigsaw pieces straight away, but with no data in them.
Any help appreciated. Code is as follows:
GML:
//Check if ds_grid for current group exists as a key. If not, create and clear it.
if !(ds_map_exists(allJigsaws, groupName)) {
ds_map_add(allJigsaws, groupName, ds_grid_create(5, numberInGroup))
ds_grid_clear(ds_map_find_value(allJigsaws, groupName), -1000);
}
//Add values to group ds_grid
ds_grid_set(ds_map_find_value(allJigsaws, groupName), 0, number, line1text);
ds_grid_set(ds_map_find_value(allJigsaws, groupName), 1, number, line2text);
ds_grid_set(ds_map_find_value(allJigsaws, groupName), 2, number, line2indent);
ds_grid_set(ds_map_find_value(allJigsaws, groupName), 3, number, correctX);
ds_grid_set(ds_map_find_value(allJigsaws, groupName), 4, number, correctY);
//Check if group ds_grid has been completely filled out
if !(ds_grid_value_exists(ds_map_find_value(allJigsaws, groupName), 0, 0, 4, numberInGroup - 1, -1000)) {
//If it has, create jigsaw pieces based on data in the grid
var n;
for (n = 0; n < numberInGroup; n += 1) {
scr_jigpiece(ds_grid_get(ds_map_find_value(allJigsaws, groupName), 0, n),
ds_grid_get(ds_map_find_value(allJigsaws, groupName), 1, n),
ds_grid_get(ds_map_find_value(allJigsaws, groupName), 2, n),
ds_grid_get(ds_map_find_value(allJigsaws, groupName), 3, n),
ds_grid_get(ds_map_find_value(allJigsaws, groupName), 4, n))
}
//Then delete the grid
ds_grid_destroy(ds_map_find_value(allJigsaws, groupName));
}