Files
chuchu/utils.lua
2021-05-13 18:14:44 +02:00

18 lines
428 B
Lua

-- Chuchu by Makaron
-- Some milescenious (not sure about how to write it) functions
local utils = { }
utils.getCenterByXY = 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)
rect:setType('static')
return rect
end
return utils