So I am used to the way my own Lua Interpreter (like corona but for psp “its called LuaPlayer Euphoria”) works. basically you would/could layout your game like so…
state = "MENU"
function menu()
--whatever
end
function game()
--whatever
end
while true do
if state == "MENU" then
menu()
elseif state == "GAME" then
game()
end
Do you guys just use event listeners ? I have toyed with this for a while, but after going between states a few times one of my scenes eventually gets corrupt and no longer functions.
If you have a sample of how state controllers work (and are stable) in corona, would you mind posting one up?
I guess it is just me finding the whole event listener things a bit odd.
Thank you [import]uid: 6981 topic_id: 4086 reply_id: 304086[/import]
I don’t know if this is the best way to do it or not. This is just how I’ve done it.
For turn based:
While in regular menus, I jump from function to function while nothing is really running.
Then when launching the game, I like to start the enterFrame runtime to then manage a string that has a value representing the game state. I update and check against this value. The runtime continuously runs loops and checks the game state. When prompting for user input, I set the state to wait (which has no commands in it). When I go back to menus I kill the runtime and other things in memory.
For active:
Hey whatever works. Several runtimes or one. It depends on how you want to implement it. Right now I prefer a single thread calculating and drawing, but I could get into letting more things happen independently and doing their own thing.
P.S.
Maybe you don’t want to use a while loop, it’s way too tight and halts other things occurring on their own if I recall correctly. Like in the simulator, you won’t even be able to quit the program or restart the simulator if you’re doing too much. [import]uid: 11024 topic_id: 4086 reply_id: 12619[/import]