Page 1 of 1
"attempt to compare number with nil" syntax error
Posted: Tue Sep 22, 2015 12:20 am
by boobeebah13
this is really annoying, I was setting up my camera movement, but when i tried to run the game it came up with a syntax error saying [refer to title] the only problem is that there is nothing wrong with the syntax in my code, well i don't think so at least,
Re: "attempt to compare number with nil" syntax error
Posted: Tue Sep 22, 2015 12:29 am
by MadByte
The programming language is always right, especially when saying that you made a mistake :p
Code: Select all
if player.x > love.graphics.getWidth() / 2 then
camera.x = player.x - love.graphics.getWidth() / 2
end
if player.y > love.graphics.getWidth() / 2 then
camera.y = player.y - love.graphics.getWidth() / 2
end
you dont have player.x and player.y declared as variables.. you need to use px and py instead.
Re: "attempt to compare number with nil" syntax error
Posted: Tue Sep 22, 2015 1:42 am
by boobeebah13
alright, just a classic case of stupidity