I discovered today that I was not thinking about the automatic pathing tool correctly. The stuff I did on it yesterday was going to require a whole ton of ElseIf statements, one for each combination of direction and secondary offset direction. Doing that would have resulted in incredibly opaque code involving a million tuples and combinations of "1", "0", and "-1".
Now, I have coupled arrow direction and offset. All the preparation part needs to do is give a set of points with their direction and a distance. It determines those by first moving straight until there is no difference between dX and dY and then moving diagonally for the rest of the way. It works, and it's fast, but it has some problems with creating extra arrows off the real path if the user makes a convex cycle.
No comments:
Post a Comment