Olof Bjarnason wrote:
Yes, but how do you know which walls are on the line?Look here, when you draw a line, you automatically know which points
are on that line. Google "line drawing" or "bresenhams line segment
algorithm".
Yes, yes, keep your hair on, I understand bresenhams algorithm.
Oh, okay, it makes sense now. I didn't realize that the x,y position was refering to one of the cells (that can be either a wall or a floor) in the 40x40 grid. When you said
No, the x,y position is one of the candidate coordinates on the grid.So the x,y position is the point at which the line intersects the wall?When you have such an algorithm from drawing lines on Stephen's grid, it is easily modified to instead of drawing a "pixel" at location (x,y), doing the test I mentioned earlier. That's where my x and y comes from.
-- Jacob Briggs Systems Engineer
Core Technology Limited Level 1, NZX Centre 11 Cable Street Wellington Phone +64 4 499-1108
--
Named after its country of origin 'England', English is a little known dialect used by up to 1.5 billion non-Americans worldwide. Some interesting but obviously incorrect features of the language include:
- queues of people - wonderful coloUrs - the useful metal aluminIum - the exotic herbs (h-urbs), basil (ba-zil) and oregano (o-re-gaa-no) - specialiSed books called 'dictionaries' that tell you how to spell words correctly
Many people using this bizarre gutter speak also subscribe to the pagan belief that water freezes at 0 degrees and that distances should be measured in the forbidden mathematical system of base-10...
--------------------- To unsubscribe go to http://gameprogrammer.com/mailinglist.html