Skip to main content

Indie game storeFree gamesFun gamesHorror games
Game developmentAssetsComics
SalesBundles
Jobs
TagsGame Engines
(1 edit)

do it like this (make sure you delete path when done with it): 

var path_array = ap_grid_path_array(obj_tester.grid, x, y, mouse_x, mouse_y);

path = path_add();

for(var i = 0; i < array_length(path_array); i++){

var point = path_array[i];

path_add_point(path, point[0], point[1], 1);

}

path_start(path, 3, path_action_stop, 0);

With help from the gamemaker discord they came up with this,
Global left click is the same as the demo file, on the Global right click i added follow_path = true

if follow_path = true{

var points_array = path

if array_length(points_array) = 0{

  speed = 0}

else{

  if point_distance(x,y,points_array[0,0], points_array[0,1]) > walk_speed{

    move_towards_point(points_array[0,0],points_array[0,1], walk_speed)  }

  else{

    x = points_array[0,0]

    y = points_array[0,1]

    array_shift(points_array)  }

 }

}

This works really well!