Issue with using Hump Module and graphics.draw functions.
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: Thu Feb 27, 2014 10:42 pm
Issue with using Hump Module and graphics.draw functions.
i am trying to use the Hump module to change game states within my game. i am able to change the game state, however certain love.graphics are providing errors. these are love.graphics.draw(...), love.graphics.setFont(...). they all bring up an error say "Incorrect parameter type: Expected userdata"
- Attachments
-
- Just one more yard.zip
- All the files you should need
- (1.07 MiB) Downloaded 67 times
- SneakySnake
- Citizen
- Posts: 94
- Joined: Fri May 31, 2013 2:01 pm
- Contact:
Re: Issue with using Hump Module and graphics.draw functions
The zip you provided does not contain gamestate.lua.
Anyway...
I see you are defining the love.load() callback in each file that contains a state.
In Lua, when you define a function that already exists, the old definition gets overridden by the new definition.
Here is an example: http://ideone.com/BYmtpz
In your case, the love.load() defined in main.lua is the last definition. So LÖVE will only call the love.load() function defined in main.lua. Your other love.load() functions will never get called (as they don't exist anymore).
So where do you put the one-time setup code for your states?
hump.gamestate has an init() callback where you can do just that.
Anyway...
I see you are defining the love.load() callback in each file that contains a state.
In Lua, when you define a function that already exists, the old definition gets overridden by the new definition.
Here is an example: http://ideone.com/BYmtpz
In your case, the love.load() defined in main.lua is the last definition. So LÖVE will only call the love.load() function defined in main.lua. Your other love.load() functions will never get called (as they don't exist anymore).
So where do you put the one-time setup code for your states?
hump.gamestate has an init() callback where you can do just that.
Who is online
Users browsing this forum: Ahrefs [Bot], Iori Branford, kov_serg and 7 guests