![]() Ygoal = ds_grid_value_y(ds_gridpathfinding, x_previous-1,ygoal, x_previous+1,ygoal+1,i) // Store the Y coordinate in ygoal Xgoal = ds_grid_value_x(ds_gridpathfinding, xgoal-1,ygoal, xgoal+1,ygoal+1,i) // Store the X coordinate in xgoal If ds_grid_value_exists(ds_gridpathfinding, xgoal-1,ygoal, xgoal+1,ygoal+1, i) /// Check if left / right, jump 1 block vertically left right X_previous=xgoal // We put in x previous the variable xgoal. ![]() Value = ds_grid_get(ds_gridpathfinding,xgoal,ygoal) /// Value in grid pathfinding of the goal position Path_add_point(path_building, xgoal*O_Grid.cell_width + (O_Grid.cell_width/2), ygoal*O_Grid.cell_height +(O_Grid.cell_height/2), 100) /// Initialize the first point of the path Var x_previous /// Coordinate of X previous ![]() Path_building = path_add() /// Create a path where we will add all the points Var ygoal = argument1 /// Y coordinate where we want to go Var xgoal = argument0 /// X coordinates where we want to go If ds_grid_get(ds_gridpathfinding,ax-1,ay+n-1)=-1 & ds_grid_get(ds_gridpathfinding,ax-1,ay+n)= -2ĭs_grid_set(ds_gridpathfinding,ax-1,ay+n-1,i) It is for delete all the previous points. Var size_list = ds_list_size(point_list) // Update the size of the list. /ds_grid_destroy(ds_gridpathfinding) /// Grid has to be delete. Path_found = 0 // 0 means that the path is not foundĭs_gridpathfinding = ds_grid_create(ds_grid_width(global.ds_grid_pathfinding), ds_grid_height(global.ds_grid_pathfinding)) ĭs_grid_copy (ds_gridpathfinding, global.ds_grid_pathfinding) ĭs_list_destroy(point_list) // We don't need the list anymore because we find a path. Var ygoal = argument3 // Y Position where we want to go Var xgoal = argument2 // X Position where we want to go
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |