Page 1 of 1

Help with Camera Layers

Posted: Sat Feb 27, 2016 7:40 pm
by BruceTheGoose
I'm trying to implement parallax scrolling but I have ran into a wall.

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
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