C
C#4mo ago
Theos

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.
No description
2 Replies
SamwiseTheBrave
SamwiseTheBrave4mo ago
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:
------------------------------->
0 x+
------------------------------->
0 x+
@Theos
Theos
Theos4mo ago
yeah, that makes sense and yes, my coordinate system works like that
Want results from more Discord servers?
Add your server
More Posts