Hello, I’d like to add a “drawing” line of elements, like a wall in some RTS games. If you press a mouse and move it to the X/Y direction, then it should draw a row of elements.
My problem is I have no idea how to do it properly. I mean, I’m taking care of 3 aspects of such a functionality:
- The beginning and ending (is it connected to “something”, for instance, tower)
- Does it have any leaks in the line(it should be fully connected with each of parts of the wall)
- Has anything changed “while” playing, for instance, it was destroyed or it loses connection to the “something”(tower for instance)
I thought about making a bunch of small objects, but I believe I will have a problem with determining if everything is connected. I had to check everything with each update which I believe is resource-consuming.
I thought about treating it as one object, but I guess I will have a problem with removing parts of the wall or determining the condition of each part.
Then, how should I make this? What’s the proper approach to such a problem?