- Home /
How to draw an outline over a shape composed of many squares in a square grid?
I have a square grid, I need to display movement range. I can already compute which squares are within the movement range.
In that example, the squares with X's are within the move range. Red X's represent the exterior of the move range. The blue X is the starting point (where the character is).
But I want to draw an outline over all the squares in that collection of squares (they are currently stored in a generic Dictionary). How do I do that?
I edited the screenshot to show what I want. I want to draw that orange line somehow.
I can pretty much get that I need to check each side of the red X squares, if the neighboring square isn't part of the move range, I should draw a line for that side. I would probably store all those in some list.
My problem is the line drawing method requires an ordered list of points (to draw lines on each resulting pair of Vector3 positions in that list), so I need to sort what I got, and that's what I have no idea how to do so.
It gets even more difficult when I need to consider a move range with "holes" in them. Like this:
I colored it in a lighter shade of orange to compare.
Answer by yigitkahramn · Feb 16, 2019 at 07:37 AM
If you did achieve, may you share your solution please. Looking for the same thing.