Hey Everyone,
So I've just started making my first proper game (Check it out here: https://github.com/tom7tomm/SuperDodger), and have got an error whilst trying to create a rectangle to be drawn on the scree. It says "Error: Bad Argument #2 to rectangle (number expected, got nil)" This only happens when I press space to start the game, and I will upload a .love file. How do I stop this?
Thanks!
Error: Bad Argument #2 to rectangle
Forum rules
Before you make a thread asking for help, read this.
Before you make a thread asking for help, read this.
Error: Bad Argument #2 to rectangle
- Attachments
-
- game.love
- (65.2 KiB) Downloaded 88 times
Check out my blog - The place to find out about the latest tech news! http://thegeekcircle.blogspot.co.uk/
Re: Error: Bad Argument #2 to rectangle
The error means that the second argument in the rectangle call is nil, but a number is needed. The second argument is player.x. It is defined in player.load, player.load is never run. To fix this, add player.load to line ~24 in menu.lua (where you switch from menu to gameplay).
Check out my blog on gamedev
Re: Error: Bad Argument #2 to rectangle
Aha, thanks. Didn't notice that I never said to run player.load!
Check out my blog - The place to find out about the latest tech news! http://thegeekcircle.blogspot.co.uk/
Who is online
Users browsing this forum: Google [Bot], PotatoDude and 202 guests