MenuScreen = {}
r = 255
b = 255
g = 255
ly = -120
t = 0
function wait(seconds)
while seconds > 0 do
seconds = seconds - coroutine.yield(true)
end
end
function MenuScreen:start()
self.objects = {}
self.co = coroutine.wrap(function()
ly = -120
wait(1)
self.objects[1] = love.graphics.newImage(idir.."gametitle.png")
repeat
wait(.01)
t = t + 5
ly = ly + 5
until ly >= 120
wait(0.5)
end)
end
function MenuScreen:update(dt)
self.co(dt)
end
function MenuScreen:draw()
for i = 1, #self.objects do -- Error is here according to the console...
love.graphics.setColor(r,g,b,t)
love.graphics.draw(self.objects[i],0,ly)
end
end
So I randomly started to get this error. Any help? ;-;
You only check for ready once, when it's false. Solution: remove every mention of that awful piece of global state ready and call MenuScreen:start() instead of setting it to true.