GM Version: GMS2 V2.2.0.258+
Target Platform: ALL
Download: N/A
Links: N/A
[Edit] I plan on redoing this video....eventually
sometime soon
Summary:
This is my first tutorial. Hope it was easy to understand.
It goes over how to use mp_grids
Tutorial:
Its kind of bad so I dont recommend watching this anymore
its still useful but I accidentally swapped the hcells and vcells
and the audio is to low and you need to use closed captions
Target Platform: ALL
Download: N/A
Links: N/A
[Edit] I plan on redoing this video....
sometime soon
Summary:
This is my first tutorial. Hope it was easy to understand.
It goes over how to use mp_grids
Tutorial:
Its kind of bad so I dont recommend watching this anymore
its still useful but I accidentally swapped the hcells and vcells
and the audio is to low and you need to use closed captions
Code:
[CREATE EVENT]
//create the grid
var cell_width = 32;
var cell_height = 32;
var vcells = room_height div cell_width;
var hcells = room_width div cell_height;
global.grid = mp_grid_create(0, 0, hcells, vcells, cell_width, cell_height);
//add collisions
mp_grid_add_instances(global.grid, obj_wall, true);
//create path
global.pathfind = path_add();
Code:
[ROOM START]
//destroy grid
mp_grid_destroy(global.grid);
path_delete(global.pathfind);
//recreate the grid
event_perform(ev_create,0);
Code:
global.target_x = (obj_cheese.x)
global.target_y = (obj_cheese.y)
//create the path and move
if (mp_grid_path(global.grid,global.pathfind,x,y,global.target_x,global.target_y,1))
{
path_start(global.pathfind,10,path_action_stop,false);
}
Last edited: