MDGSF Software Engineer

[Lua-love2d] 检测两个2D平面上2个矩形是否重叠

2017-08-09
mdgsf
lua

function collisions.check_rectangles_overlap(a, b)
    local overlap = false
    if not(
        a.x + a.width < b.x or
        b.x + b.width < a.x or
        a.y + a.height < b.y or
        b.y + b.height < a.y
         ) then
        overlap = true
    end
    return overlap
end

weixingongzhonghao

上一篇 [Nginx] 红黑树

Comments

Content