Ygoal = ds_grid_value_y(ds_gridpathfinding, x_previous-2,ygoal, x_previous+2,ygoal+1,i) If ds_grid_get (ds_gridpathfinding, x_previous + sign(xgoal-x_previous), ygoal) = -1 /// Check if enemy could really jump Xgoal = ds_grid_value_x(ds_gridpathfinding, xgoal-2,ygoal, xgoal+2,ygoal+1,i) If ds_grid_value_exists(ds_gridpathfinding, xgoal-2,ygoal, xgoal+2,ygoal+1, i) /// Check if diagonal jump (big jump) or Horizontal jump (jump over a void) 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) // Add point in path
This series of GameMaker tutorials was written by two indie game developers, Nathan Ranney (ratcasket) and Alejandro Hitti (AleHitti). It offers a streamlined development process so you can take your idea from concept to finished game. 1 audio asset.yyz project file you can import into GameMaker Studio 2. Ygoal = ds_grid_value_y(ds_gridpathfinding, x_previous-1,ygoal, x_previous+1,ygoal+1,i) // Store the Y coordinate in ygoal GameMaker Studio 2 is a cross-platform game engine developed by YoYo Games. These are the assets I used in my Platformer game tutorial. 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 This short tutorial takes roughly an hour with both videos being around 30 minutes. 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 Intermediate Our latest official GameMaker Studio 2 tutorial has been created by Shaun Spalding and is a 2 part video series setting you up with your own Platformer game using GameMaker Language (GML).
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