Help with Camera Layers
Posted: Sat Feb 27, 2016 7:40 pm
I'm trying to implement parallax scrolling but I have ran into a wall.
I'm using this tutorial:
http://nova-fusion.com/2011/04/22/camer ... scrolling/
The end result is that nothing gets drawn onto the screen.
Here is the code
Code: Select all
World = {}
function World.load()
camera:newLayer(1,Player:draw()) -- Adding new layers
camera:newLayer(1, function()
for _,v in ipairs(Particle) do v:draw() end
end)
end
function World.update(self,dt)
for i = #Particle, 1, -1 do if Particle[i].remove then table.remove(Particle, i) end end
for _,v in ipairs(Particle) do v:update(dt) end
Player:update(dt)
camera:setPosition(Player.x-Game.width/2,Player.y-Game.height/2)
end
function World.draw()
camera:draw()
end
http://nova-fusion.com/2011/04/22/camer ... scrolling/
The end result is that nothing gets drawn onto the screen.
Here is the code