"attempt to compare number with nil" syntax error

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
Post Reply
boobeebah13
Prole
Posts: 7
Joined: Sun Sep 20, 2015 12:16 am

"attempt to compare number with nil" syntax error

Post 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,
Attachments
my game.love
here is the .love
(9.63 KiB) Downloaded 128 times
User avatar
MadByte
Party member
Posts: 533
Joined: Fri May 03, 2013 6:42 pm
Location: Braunschweig, Germany

Re: "attempt to compare number with nil" syntax error

Post 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.
boobeebah13
Prole
Posts: 7
Joined: Sun Sep 20, 2015 12:16 am

Re: "attempt to compare number with nil" syntax error

Post by boobeebah13 »

alright, just a classic case of stupidity
Post Reply

Who is online

Users browsing this forum: Bing [Bot], MisterImpossible, steVeRoll and 4 guests