F
freaky
Guest
Hello guys,
I am working on a procedural room generation , however I am storing all the data in a ds_grid before creating everything. The thing is that let's say I make a ds_grid which is for instance 40x40 and if I need to expand it I can just use ds_grid_resize. However this adds extra rolls and columns at the end and in my case sometimes I need to add additional rows and columns at the beginning of the ds_grid. I tried creating a temporary second ds_grid which is bigger and then copying the first grid on another position but I get strange results
xx and yy are the coords of the current position.
Any ideas what's wrong?
I am working on a procedural room generation , however I am storing all the data in a ds_grid before creating everything. The thing is that let's say I make a ds_grid which is for instance 40x40 and if I need to expand it I can just use ds_grid_resize. However this adds extra rolls and columns at the end and in my case sometimes I need to add additional rows and columns at the beginning of the ds_grid. I tried creating a temporary second ds_grid which is bigger and then copying the first grid on another position but I get strange results
Code:
var temp_w = width+path_length;
var temp_h = width+path_length;
var t_grid = ds_grid_create(temp_w,temp_h);
ds_grid_set_region(t_grid,0,0,temp_w,temp_h,-1);
ds_grid_copy(grid,t_grid);
ds_grid_resize(grid,temp_w,temp_h);
ds_grid_clear(grid,-1);
ds_grid_set_grid_region(t_grid,grid,0,0,width,height,path_length,path_length);
ds_grid_destroy(t_grid);
width+=path_length;
height+=path_length;
xx+=path_length;
yy+=path_length;
Any ideas what's wrong?