made an utils module
This commit is contained in:
17
utils.lua
Normal file
17
utils.lua
Normal file
@@ -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
|
||||||
Reference in New Issue
Block a user