Colliding with a drawn line

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
User avatar
Lazy Waffle
Prole
Posts: 5
Joined: Sat Nov 28, 2009 11:26 pm
Location: Somewhere

Colliding with a drawn line

Post by Lazy Waffle »

Is it possible to check if something collides with a line drawn with the love.graphics.line() function? Here's the code I use to draw the line:

Code: Select all

function draw()
	love.graphics.line(x1,y1,x2,y2)
	love.graphics.circle(1,x1,y1,10)
	love.graphics.circle(1,x2,y2,10)
end
x1, x2, y1, and y2 can be moved by the arrow keys and WASD.

Help would be appreciated :ultraglee:
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Colliding with a drawn line

Post by TechnoCat »

User avatar
Lazy Waffle
Prole
Posts: 5
Joined: Sat Nov 28, 2009 11:26 pm
Location: Somewhere

Re: Colliding with a drawn line

Post by Lazy Waffle »

My game doesn't use Box2D physics, would it still work? Or is there an alternative?
User avatar
TechnoCat
Inner party member
Posts: 1611
Joined: Thu Jul 30, 2009 12:31 am
Location: Denver, CO
Contact:

Re: Colliding with a drawn line

Post by TechnoCat »

Post Reply

Who is online

Users browsing this forum: Bing [Bot] and 55 guests