Switching gamestates
Posted: Tue Aug 23, 2011 8:49 am
This is my first post here, so hello everyone. I've got a problem with gamestates. Here's the main.lua:
First, i load game.lua so there won't be any errors. My game is based on love.physics. Game.lua is the level of the game, and i want to have menu done exactly the same way as level, but when i load menu gamestate, objects defined in game.lua are still on their places. Is there any way to unload a state, then load a new one?
Code: Select all
require 'game'
require 'menu'
game.load()
function love.load()
end
function love.update(dt)
currstate.update(dt)
end
function love.draw()
currstate.draw()
end
currstate = menu