Page 1 of 1
Issue with using Hump Module and graphics.draw functions.
Posted: Thu Feb 27, 2014 10:48 pm
by goosingout
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"
Re: Issue with using Hump Module and graphics.draw functions
Posted: Fri Feb 28, 2014 12:23 am
by SneakySnake
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.