Deleting Objects from a Grid

R

Ronaldo

Guest
I'm making a maze game, and I have an object that can move to the mouse's position when the left mouse button is clicked. It works perfectly fine, and my code to make it avoid the walls works. However, a problem has arisen when I added a different type of wall. I added this wall using the mp_grid_add_instance code. However, because this different wall can be destroyed by my player, I want to remove it from the grid and allow my object to pass through there. Is there a way to remove an object from the grid?
 

Attachments

I've never used mp_grids, but I think you can use the clear function. Something like this on the event that destroys the blocking object;
Code:
mp_grid_clear_cell(obj_gridcontroller.mp_grid, floor(x / 32), floor(y /32));
Where x & y are the position of the object that needs to be removed and 32 would be your grids cell size
 
Top