Bentley
Member
I'm moving the player on a ds_grid. I want to keep him inside the grid. I saw the function ds_grid_get and thought it could work: "If you pass invalid grid coordinates, then the value returned will be 0." I'd use what ds_grid_get returns to check if the player's planned move is on the board.
I must be misunderstanding how the function works. Does anyone know where I'm going wrong? Thanks for reading.
Code:
// Is the next move on the grid?
var on_grid = ( ds_grid_get(global.grid, next_cell_x, next_cell_y) != 0 );
if (on_grid)
{
// Move to that cell
}
Last edited: