added more utility functions
This commit is contained in:
@@ -7,6 +7,10 @@ utils.getCenterByXY = function (x, y, w, h)
|
||||
return { x = (x + (w/2)), y = (y + h/2) }
|
||||
end
|
||||
|
||||
utils.getXYByCenter = function (x, y, w, h)
|
||||
return { x = (x - (w/2)), y = (y - (h/2)) }
|
||||
end
|
||||
|
||||
utils.spawnStaticRectangleBySize = function (world, x, y, w, h)
|
||||
local center = utils.getCenterByXY(x, y, w, h)
|
||||
local rect = world:addRectangle(center.x, center.y, w, h)
|
||||
|
||||
Reference in New Issue
Block a user