Skip to content
State machine (FSM) templates

Game Session (State Machine)

Menu, play, pause and game-over states.

Template previewState machine (FSM)
Game session4 states · 5 transitions · 5 eventsstartpauseresumedierestartMenuPlayingPausedGameOverAll 4 states are reachable and every transition names states that exist.OKAll 4 states are reachable from `Menu`.OKEvery run from `Menu` can reach the final state.OKAll 5 transitions name states that exist, so every arrow in the figure is drawn.

Make it your own.

title "Game session"
state Menu
state Playing
state Paused
state GameOver final
initial Menu
transition Menu -> Playing on "start"
transition Playing -> Paused on "pause"
transition Paused -> Playing on "resume"
transition Playing -> GameOver on "die"
transition GameOver -> Menu on "restart"