r/pygame•
iminurnamez

Simple State Machine Example

You've probably seen myself and others recommend u/Mekire's multiscene template before and with good reason, but I know it can be a bit intimidating - I noped out the first time I saw it. With that in mind, I wrote up a single-file, pared-down version in the hope it can serve as a stepping stone to grokking the full template: https://gist.github.com/iminurnamez/8d51f5b40032f106a847

The example consists of a simple game (to use the term very loosely) with two states/scenes, a splash screen and a gameplay screen. Clicking or pressing a button exits the splash screen and starts the gameplay state. Hopefully this is helpful, let me know if anything's unclear or you have any questions or comments.

Posted Sep 10, 2015, 9:06 PM UTC

107
Loading comments…