L
Logan Bevans
Guest
So im using a grid and a path system for an enemy ai. in my game the room changes when i move how would i go about moving the grid to my view this is the code for obj_grid:Create
how do i keep the height and width variable current with the position of the object im using them in the creation of the grid but if i move away from the height and width variables they dont change since its only in the create even but if i put the code in the step event wouldn't it just create a bunch of grids?
var cell_width = 32;
var cell_height = 32;
height = x + 640;
width = y + 480
var hcells = height; //Change to a view
var vcells = width; //Change to a view
global.grid = mp_grid_create(x,y,hcells, vcells, cell_width, cell_height);
//global.grid = mp_grid_create(0,0, hcells, vcells, cell_width, cell_height);
//Adding Path Collsions
mp_grid_add_instances(global.grid,obj_solidblock,false);
how do i keep the height and width variable current with the position of the object im using them in the creation of the grid but if i move away from the height and width variables they dont change since its only in the create even but if i put the code in the step event wouldn't it just create a bunch of grids?
var cell_width = 32;
var cell_height = 32;
height = x + 640;
width = y + 480
var hcells = height; //Change to a view
var vcells = width; //Change to a view
global.grid = mp_grid_create(x,y,hcells, vcells, cell_width, cell_height);
//global.grid = mp_grid_create(0,0, hcells, vcells, cell_width, cell_height);
//Adding Path Collsions
mp_grid_add_instances(global.grid,obj_solidblock,false);