+function doLinesIntersect(x1, y1, x2, y2, x3, y3, x4, y4)
+ if x1 == x2 and x3 == x4
+ or y1 == y2 and y3 == y4
+ then
+ -- if lines are parallel, no intersection!
+ return false
+ else
+ -- if lines are not parallel, they must intersect
+ -- do segments overlap?
+ if
+ x1 <= x3 and x3 <= x2
+ and y1 <= y3 and y3 <= y2
+ or
+ x3 <= x1 and x1 <= x4
+ and y3 <= y1 and y1 <= y4
+ then
+ scene.paused = true
+ scene.intersection = {x1, y1, x2, y2, x3, y3, x4, y4}
+ return true
+ end
+ end
+end
+