I remember seeing a way to keep track of game states in a table, but can’t seem to find it. Could anyone give me a link or example? Thanks
Just make a class for each state, and put them in a table:
states = {
menu = Menu(),
game = Game(),
}
Then make a state
variable that stores which state is the current one. So you could do state = "game"
to set it to the game state.
In draw, touched, etc. just use something like
function draw()
states[state]:draw()
end
Thanks, that’s exactly what I was looking for SkyTheCoder
I found this scene manager example to be HUGELY helpful to me:
http://codea.io/talk/discussion/677/scenemanager/p1
It really helped me organise the game I’m working on.