In Lua:
[lua]
function c(cx1, cy1, w1, h1, cx2, cy2, w2, h2)
tlx1 = cx1 - (w1 * 1/2)
tly1 = cy1 + (h1 * 1/2)
brx1 = cx1 + (w1 * 1/2)
bry1 = cy1 - (h1 * 1/2)
tlx2 = cx2 - (w2 * 1/2)
tly2 = cy2 + (h2 * 1/2)
brx2 = cx2 + (w2 * 1/2)
bry2 = cy2 - (h2 * 1/2)
if (tlx1 < brx2 and tly1 > bry2) or (tlx2 < brx1 and tly2 > brx2) then
return true
else
return false
end
end
function d(tlx1, tly1, brx1, bry1, tlx2, tly2, brx2, bry2)
if (tlx1 < brx2 and tly1 > bry2) or (tlx2 < brx1 and tly2 > brx2) then
return true
else
return false
end
end
[/lua]
c(Rectangle1CenterX, Rectangle1CenterY, Rectangle1Width, Rectangle1Height, Rectangle2CenterX, Rectangle2CenterY, Rectangle2Width, Rectangle2Height)
d(Rectangle1TopLeftX, Rectangle1TopLeftY, Rectangle1BottomRightX, Rectangle1BottomRightY, Rectangle2TopLeftX, Rectangle2TopLeftY, Rectangle2BottomRightX, Rectangle2BottomRightY)
I don't think that default Lua has a coordinates object. If it does I have a slightly simpler one that works in Buildism Lua.
[lua]
function c(cx1, cy1, w1, h1, cx2, cy2, w2, h2)
tlx1 = cx1 - (w1 * 1/2)
tly1 = cy1 + (h1 * 1/2)
brx1 = cx1 + (w1 * 1/2)
bry1 = cy1 - (h1 * 1/2)
tlx2 = cx2 - (w2 * 1/2)
tly2 = cy2 + (h2 * 1/2)
brx2 = cx2 + (w2 * 1/2)
bry2 = cy2 - (h2 * 1/2)
if (tlx1 < brx2 and tly1 > bry2) or (tlx2 < brx1 and tly2 > brx2) then
return true
else
return false
end
end
function d(tlx1, tly1, brx1, bry1, tlx2, tly2, brx2, bry2)
if (tlx1 < brx2 and tly1 > bry2) or (tlx2 < brx1 and tly2 > brx2) then
return true
else
return false
end
end
[/lua]
c(Rectangle1CenterX, Rectangle1CenterY, Rectangle1Width, Rectangle1Height, Rectangle2CenterX, Rectangle2CenterY, Rectangle2Width, Rectangle2Height)
d(Rectangle1TopLeftX, Rectangle1TopLeftY, Rectangle1BottomRightX, Rectangle1BottomRightY, Rectangle2TopLeftX, Rectangle2TopLeftY, Rectangle2BottomRightX, Rectangle2BottomRightY)
I don't think that default Lua has a coordinates object. If it does I have a slightly simpler one that works in Buildism Lua.