Code: Select all
function leftcollide(x1,y1,w1,h1,x2,y2,w2,h2)
local i
for i = 0, h1 - 1 do
if y1 + i > y2 and y1 + i < y2 + h2 and x1 > x2 and x1 < x2 + w2 then
return true
end
end
return false
end
function rightcollide(x1,y1,w1,h1,x2,y2,w2,h2)
local i
for i = 0, h1 - 1 do
if y1 + i > y2 and y1 + i < y2 + h2 and x1 + w1 > x2 and x1< x2 then
return true
end
end
return false
end
function upcollide(x1,y1,w1,h1,x2,y2,w2,h2)
local i
for i = 0, h1 - 1 do
if x1 + i > x2 and y1 > y2 and y1 < y2 + h2 then
return true
end
end
return false
end
function downcollide(x1,y1,w1,h1,x2,y2,w2,h2)
local i
for i = 0, h1 - 1 do
if x1 + i > x2 and y1 < y2 and y2 < y1 + h2 then
return true
end
end
return false
end