E
Erian
Guest
Hi!
I have searched on Google, but haven't found an answer yet.
I am looking to find a method that I can use in order to find out whether the player can reach all of the point instances that are in the level. I am producing the levels procedurally, so I will have to check whether they can be completed.
The game has a top-down view. The player can move up, down, left and right (not diagonally) and snaps to the square grid. The player can walk everywhere except for through walls, which are 1 square in size. The point items may be placed everywhere, except for on walls.
I have already tried checking which tiles the player can reach. I tried placing an invisible oject on each of the 4 (up, down, left, right) tiles the player can go to from the starting position (i.e. those that don't have a wall on them). I tried to add those instances to an array or list, read the x and y positions from each of the 4 instances and check the 4 squares around them on whether they can be reached. Place an instance on every tile like this untill you can't reach anything anymore. Then check whether all points are on that.
I can't however read the x and y positions from the instances that I stored in the array. I don't want to double check tiles either, which is why I can't simply make two lists, one for y and one for x coordinates. That way I would not be able to check whether a set of coordinates is already in the list.
I also thought about checking whether any walls complete a full enclosure. Problem here is that the outside of the whole level is also enclosed by walls, and that I haven't found a way to deal with branching walls and solid wall rectangles. (i.e. a 2X3 rectangle would not enclose an open space, but does complete a circle)
Are there any simpler methods for doing this? Is there anything in GameMaker already that can do this?
Or does anyone have a suggestion? I'm really stuck.
I have searched on Google, but haven't found an answer yet.
I am looking to find a method that I can use in order to find out whether the player can reach all of the point instances that are in the level. I am producing the levels procedurally, so I will have to check whether they can be completed.
The game has a top-down view. The player can move up, down, left and right (not diagonally) and snaps to the square grid. The player can walk everywhere except for through walls, which are 1 square in size. The point items may be placed everywhere, except for on walls.
I have already tried checking which tiles the player can reach. I tried placing an invisible oject on each of the 4 (up, down, left, right) tiles the player can go to from the starting position (i.e. those that don't have a wall on them). I tried to add those instances to an array or list, read the x and y positions from each of the 4 instances and check the 4 squares around them on whether they can be reached. Place an instance on every tile like this untill you can't reach anything anymore. Then check whether all points are on that.
I can't however read the x and y positions from the instances that I stored in the array. I don't want to double check tiles either, which is why I can't simply make two lists, one for y and one for x coordinates. That way I would not be able to check whether a set of coordinates is already in the list.
I also thought about checking whether any walls complete a full enclosure. Problem here is that the outside of the whole level is also enclosed by walls, and that I haven't found a way to deal with branching walls and solid wall rectangles. (i.e. a 2X3 rectangle would not enclose an open space, but does complete a circle)
Are there any simpler methods for doing this? Is there anything in GameMaker already that can do this?
Or does anyone have a suggestion? I'm really stuck.