I know there have been allot of these topics, but each one seems to have different solution and so far none have resolved the titular error. the code is as follows:
goingright = true
spawnx = 100
spawny = 400
function love.load()
char = love.graphics.newImage("char.png")
charl = love.graphics.newImage("charl.png")
level = love.graphics.newImage("level.png")
x = 0
y = 0
end
function love.draw()
love.graphics.draw(level, x, y)
if not goingright then
love.graphics.draw(charl, chart.charx, chart.chary)
else
love.graphics.draw(char, chart.charx, chart.chary)
end
end
dofile("char.lua")
The error is at line 13 where the level background placeholder is drawn. Any ideas would be very useful, as this is seriously hindering me making any further progress on this project.
Your code works for me when I deleted your dofile. There's most certainly something wrong with your char.lua. Also you are calling your chart table in your love.graphics.draw, but I don't see it declared anywhere.
Also see The Rules: if you don't attach a .love, we probably can't help you.
In this case, you probably did something like "level = ..." in char.lua, like the others said. Other times, it will probably not be so easy to help you without .love.