Page 1 of 1

Bresenham's line algorithm

Posted: Fri Jan 20, 2012 9:05 pm
by Neolitik
Hello all ,

I have try to understand Bresenham's line algorithm and how can use it in Tiled 2d game.

It's just "Bresenham's line algorithm" in love, useful for make TileMap Editor , Line of Sight for Ai , Path and other !
Very useful because we know the point of the line


Mouse Left for place a point and Mouse right for undo.

By

Re: Bresenham's line algorithm

Posted: Sat Jan 21, 2012 9:11 am
by MarekkPie
Very cool. I remembering trying to do this inside of Minecraft using redstone...it never worked out.

Re: Bresenham's line algorithm

Posted: Mon Jan 23, 2012 10:36 pm
by GloryFish
Great example. I learned Bresenham's algorithm when I was working on a word search game. The lettergrid allows you to drag and select words going up/down/left/right and diagonals:

Image

Code (scroll down to pointsBetween) :

https://github.com/GloryFish/Experiment ... ergrid.lua