function pointInsideRectangle(x1, y1, x2, y2, w, h) return x1 > x2 and x1 < (x2 + w) and y1 > y2 and y1 < (y2 + w) -- An Awesome Project end function mouseInsideRectangle(x, y, w, h) local x1, y1 = love.mouse.getPosition() return pointInsideRectangle(x1, y1, x, y, w, h) end function rectangleTouchingRectangle(x1, y1, w1, h1, x2, y2, w2, h2) return (x1 + w1 > x2 and x1 < x2 + w2) and (y1 + h1 > y2 and y1 < y2 + h2) end function getTile(x, y) return (world[x] or {})[y] or {0} end function getCameraTile(cx, cy) return getTile(math.floor(cx / tilesize), math.floor(cy / tilesize)) end function s(name) -- sprite return sprites[name] end