Re: Problem to solve
Date: 05/18/03

I'd recommend looking into Bresenham's Digital Line algorithm. It is
useful for casting a ray from two digital points and performing an
operation at each step. Its often used when you want to do per pixel
calculations (like line drawing), but it can be applied to each "tile"
in your map.

A good example of it can be found in the article Digital Line Drawing by
Paul Heckbett in "Graphic Gems", Academic Press, 1990.

You could just "draw" the line from the player to each tile at the edge
of the map, and whenever you reach a "blocked" tile stop drawing the
line. Lots of games use this algorithm to reveal fog of war.

Steve Moret

   | FAQ: |
   | Archives: |
   | Newbie List:   |

This archive was generated by hypermail 2b30 : 06/26/03 PDT