diff --git a/linearallax.lua b/linearallax.lua new file mode 100644 index 0000000..66f60e0 --- /dev/null +++ b/linearallax.lua @@ -0,0 +1,28 @@ +-- Chuchu by Makaron +-- linearallax = Linear Parallax +-- Takes a mirrored sprite and quickly simulate a parallax moving linearly +-- indefinitely + +local Linearallax = {} + +function Linearallax.new(planX, planY, img, imgMirrored, speed) + obj = { + planX = 512, + planY = 512, + img = nil, + imgMir = nil, + speed = 1 + } + + if planX then obj.planX = planX end + if planY then obj.planY = planY end + if img then obj.img = img end + if imgMirrored then obj.imgMir = imgMirrored end + if speed ~ + + return setmetatable(obj, { + __index = Linearallax + }) +end + +function Linearallax:update(dt)