I am trying to implement transition between levels in my project.
The concept is very simple. Each level has its own load, update and draw method.
The load methods are structured like so:
Code: Select all
loadLevel1()
--delete all resources
--load level 1 resources
gameState = "level1"
end
loadlLevel2()
--delete all resources
--load level2 resources
gameState = "level2"
end
And this is how update and draw looks like
Code: Select all
love.update
if gameState == "level1" then updateLevel1()
if gameState == "level2" then updateLevel2()
end
love.draw()
if gameState == "level1" then drawLevel1()
if gameState == "level2" then drawLevel2()
end
I would like to somehow avoid this and delay the update until draw is executed. I tried using a boolean but it seems despite the fact my screen is freezed, love.draw continue to execute and set the boolean to true in the background.
Would anyone have any idea how to go about this?
Thank you.