1 Attachment(s)
intersection of line with walls in tile-based game?
I'm making a game that uses an array to keep track of boundaries, like a tile-based game (but the background will be art-based).
I'm trying to figure out how to determine whether or not a line is intersecting some walls. The line can be any length and rotated at any angle.
I could probably get the rows and columns that the ends of the line are on and then check all the rows and columns in between, but that seems like an awful lot of work. Is there a better way?
FWIW, There will be things attached to each end of the line, each doing their own thing, so the line will be moving slightly in a frame loop. Therefore, the solution I use will have to be fast...
The attached image shows an example of what might happen, but in the real game, the line might span many, many more rows and columns.
Thanks for any advice!
Cooper
www.pigdogtoad.com