How to find coordinates of a region
Hey, so I have a 2D array of tiles, each tile has a
gridPosX, gridPosY, tileTyp
, tileTyp
can either be red, green
I know the width and height of the grid.
I need to find where the red region of tiles starts and ends, and same for the green region. Red region can either spawn on top, bottom, left or right of the green region.2 Replies
how about storing all tiles in some collection and finding ones with max X,Y and min X,Y?
e.g here to find border between red and green regions you need to find red tile with highest X coordinate
assuming your coordinate system looks something like this:
@Theos
yeah, that makes sense
and yes, my coordinate system works like that