"attempt to compare number with nil" syntax error
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
-
- Prole
- Posts: 7
- Joined: Sun Sep 20, 2015 12:16 am
"attempt to compare number with nil" syntax error
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,
- Attachments
-
- my game.love
- here is the .love
- (9.63 KiB) Downloaded 129 times
Re: "attempt to compare number with nil" syntax error
The programming language is always right, especially when saying that you made a mistake :p
you dont have player.x and player.y declared as variables.. you need to use px and py instead.
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
-
- Prole
- Posts: 7
- Joined: Sun Sep 20, 2015 12:16 am
Re: "attempt to compare number with nil" syntax error
alright, just a classic case of stupidity
Who is online
Users browsing this forum: Google [Bot], Semrush [Bot] and 8 guests