Bresenham's line algorithm

Showcase your libraries, tools and other projects that help your fellow love users.
Post Reply
Neolitik
Citizen
Posts: 55
Joined: Sun Jun 28, 2009 3:13 pm

Bresenham's line algorithm

Post 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
Attachments
Bresenham's line algorithm.love
(791 Bytes) Downloaded 310 times
User avatar
MarekkPie
Inner party member
Posts: 587
Joined: Wed Dec 28, 2011 4:48 pm
Contact:

Re: Bresenham's line algorithm

Post by MarekkPie »

Very cool. I remembering trying to do this inside of Minecraft using redstone...it never worked out.
GloryFish
Prole
Posts: 19
Joined: Tue Jan 11, 2011 4:43 pm

Re: Bresenham's line algorithm

Post 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
Post Reply

Who is online

Users browsing this forum: No registered users and 156 guests