Re: Using sprites from a tileset
Posted: Sun Apr 03, 2011 12:59 pm
Okay, require "movement" at the top, instead of somewhere in the middle of your code. Secondly, love.load() is only called once, so the image and the quad aren't created. Lastly, you need to rename those functions in movement.lua, because they override the ones already defined. I suggest keeping a table with the callback functions for each state, so you can do things like:
Code: Select all
-- main.lua
function love.load()
states = {}
-- ...
end
function love.update(dt)
states[state].update(dt)
end
Code: Select all
--movement.lua
states.game = {}
function states.game.update(dt)
--blah
end