Simple State Manager

Just dropping my state manager class in case anyone could use it. It’s pretty simple and straight forward but I had ChatGPT add some comments and example usage.

it’s used to transition between states such as a loading state, game state, pause/resume from a stack, Etc..

StateManager.zip (2.0 KB)

2 Likes

Just took a look at the code. Something like this is what I tend to hang all my games and prototypes off, nice work.

1 Like

Thank you much, I do the same and thought if anyone else follows the same principal they may benefit from having a good state manager. I’m kind of curious to see what you use, something similar, more advanced? or is there an even simpler way to achieve the same end result.

1 Like


StateManager.zip (44.8 KB)

Just speaking for myself, I rarely use code from a project that does nothing when I push “Play”.

So I hope you don’t mind that I added a demo. Is it using the stage manager right?

1 Like

The last big project I did I used was for this little Severance fan game Terminal of Woe

If you install that, there’s a button to export the Codea project itself. I can’t recall the exact system but it was similar to yours — states can carry some additional data. I don’t think I did a BaseState — I was trying to emulate Swift’s pattern-matching enums

@sim - ran terminal of Woe for quite a long time on my iPad. Just ran it on my PC and was surprised to see a flashy introduction page - impressive. From that I take it that you can detect the hardware that Codea is running on.

Reason I am posting is you refer to a button to export the project - can’t find it - can you remember where it is ?

If you tap “Handbook” then “Open file” it will give you instructions on how to export the project.

@sim - thanks for the reply. :+1::+1::+1:

1 Like