diff --git a/utils.lua b/utils.lua new file mode 100644 index 0000000..96f6cc1 --- /dev/null +++ b/utils.lua @@ -0,0 +1,17 @@ +-- 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