Help with Camera Layers

General discussion about LÖVE, Lua, game development, puns, and unicorns.
Post Reply
User avatar
BruceTheGoose
Citizen
Posts: 76
Joined: Sat Sep 20, 2014 2:54 pm

Help with Camera Layers

Post 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
Attachments
Archive.zip
(3.04 KiB) Downloaded 70 times
"I don't know."
Post Reply

Who is online

Users browsing this forum: No registered users and 9 guests