29 lines
601 B
Lua
29 lines
601 B
Lua
-- 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)
|