M
MagnumVulcanos
Guest
Works now, here's a look:
Thank you all for your help!
As you can see this thing ignores walls, (but can still mark them if needed) and will take any floors, to be later added onto an array or flagged or whatever. and it does nothing if it finds an empty space in there, such as a wall being missing, or an empty tile. In this case, it counted 12 tiles.
/-------------------------------------------------/
The situation is as follows, I have a few square walls, all of which have par_wall as a parent, same for par_floor.
Both the walls and floor have a width that doesn't change, neither can move, they are always the same distance apart.
There are no floors and walls occupying the same place, meaning that if a collision was detected, it would never be with both.
Doors or windows are irrelevant, they are walls, items within the walls don't matter when detecting the "room".
Whenever I create a wall, I want to detect the pattern in which the floors and walls have been created.
I believe that this may not be too difficult when creating square rooms, but I want to give the player the capacity to create any shape of room they want.
To be specific, I want to detect a room, meaning a specific pattern of objects arranged with a floor surrounded with walls on all sides, external corners are irrelevant.
How would I go about this?
I don't know where to begin, but the ideal result would be a list with all the items that a room is compromised of, or at the very least a less elegant object (probably laggier) would be for every object to determine what room it's a part of?
TL;DR: given the objects floor and wall, detect if tehres an amount of floors with no holes in the middle surrounded 100% by walls, how would I detect and get all of those items within a list?
Thank you all for your help!
As you can see this thing ignores walls, (but can still mark them if needed) and will take any floors, to be later added onto an array or flagged or whatever. and it does nothing if it finds an empty space in there, such as a wall being missing, or an empty tile. In this case, it counted 12 tiles.
/-------------------------------------------------/
The situation is as follows, I have a few square walls, all of which have par_wall as a parent, same for par_floor.
Both the walls and floor have a width that doesn't change, neither can move, they are always the same distance apart.
There are no floors and walls occupying the same place, meaning that if a collision was detected, it would never be with both.
Doors or windows are irrelevant, they are walls, items within the walls don't matter when detecting the "room".
Whenever I create a wall, I want to detect the pattern in which the floors and walls have been created.
I believe that this may not be too difficult when creating square rooms, but I want to give the player the capacity to create any shape of room they want.
To be specific, I want to detect a room, meaning a specific pattern of objects arranged with a floor surrounded with walls on all sides, external corners are irrelevant.
How would I go about this?
I don't know where to begin, but the ideal result would be a list with all the items that a room is compromised of, or at the very least a less elegant object (probably laggier) would be for every object to determine what room it's a part of?
TL;DR: given the objects floor and wall, detect if tehres an amount of floors with no holes in the middle surrounded 100% by walls, how would I detect and get all of those items within a list?
Last edited by a moderator: