
Statement (GameMaker State Machines)
Make a statement with your states!
Statement: A state machine framework for GameMaker
At some point, every game ends up with state logic. You start with a state variable and a switch block. That seems fine...for a while.
Then two weeks later you have if (state == STATE_JUMP && can_wall_jump && !is_stunned && ...), a switch block the height of a small apartment building, and a bug that only happens when you roll, into a ladder, while taking damage, on a Tuesday.
Statement is here to stop that spiral before it starts.
Get the Ignition Kit bundle, featuring Pulse, Catalyst AND Statement for a discount!
Or get the Full Suite Pass bundle to get all current and future tools for one low price (price will increase each time a new tool launches, so get in early for substantial savings!)
What Statement actually does
Instead of a switch block, you create named states (each with their own Enter, Update, Exit, and optional Draw handlers), and Statement makes sure only one runs at a time. It handles the transitions, the plumbing, and the cleanup, so you can just write the logic for each state in isolation and stop worrying about how your flags interact with each other.
// Create Event
state_machine = new Statement(self);
var _idle = new StatementState(self, "Idle")
.AddEnter(function() { sprite_index = spr_idle; })
.AddUpdate(function() {
if (keyboard_check(ord("D")) || keyboard_check(ord("A"))) {
state_machine.ChangeState("Move");
}
});
state_machine.AddState(_idle);
// Step Event
state_machine.Update();
That's it. Named states, clean handlers, Statement keeps your flow sane as your project grows.
Statement Lens: see what your state machine is actually doing
Most state machines help you write state logic. Statement also helps you see it.
Lens is a fully interactable in-game visual debugger that renders your state machine as a live graph while your game runs. If you've ever said "why is this state doing that" and then spent 45 minutes sprinkling debug messages everywhere, Lens is the antidote.
With Lens you can watch transitions fire in real time, set breakpoints on state entry or transition, pause the machine and step through execution one tick at a time, jump to any state directly (yes, actually drive the machine), and see heatmaps of time spent and visits per state. You can also filter noise, search machines, hide labels, and show only recent activity.
(Open the first screenshot on the right to see a user drive their state machine through Lens, and even set a breakpoint on a transition they want the state machine to pause on!)
Note: I'm always looking to improve Lens' usefulness, so if you find a rough edge or have a suggestion, jump on the Discord and share it with me!
When your game stops being simple
The core of Statement, named states with Enter/Update/Exit and ChangeState, covers most games. But when you need more, Statement has got your back.
Declarative transitions let you attach a condition directly to a state and have Statement switch automatically when it's met, instead of checking it manually in every Update.
Queued transitions let you request a state change now and apply it safely at the end of the frame, avoiding mid-update surprises.
State stacks (PushState/PopState) are the clean solution for pause menus, cutscenes, or anything that needs to return to where it was.
Transition payloads let you pass data along with a state change, and you can even modify the payload inside the condition function before it fires.
Non-interruptible states lock a state so it can't be exited early unless you explicitly force it.
Per-machine and global time scaling makes slow-mo and fast-forward a single line of code.
Substates let you nest a full state machine inside a single state, with proper lifecycle control. LockExitUntilSubIn("Ready") means "don't leave this state until the child machine has reached Ready", which is the clean solution for things like "don't leave Attack until the attack animation has finished."
State templates let you define reusable state logic once and stamp it out across multiple instances, with optional per-instance config data.
History and introspection let you ask the machine what it was doing and when, which is as useful for debugging as it is for gameplay logic.
Custom state events let you extend the built-in Enter/Update/Exit/Draw set with your own event types, triggerable on demand.
Echo debug logger included
Statement ships with Echo, my debug logging framework for GameMaker, with level-based logs, tag filters, per-message urgency, optional stack traces, rolling history and file dumps. You don't need to buy it separately.
Documentation
Statement ships with full online docs: quickstart, common patterns, complete scripting reference, and integration guides for other RefresherTowel frameworks.
Statement docs:
https://refreshertowel.github.io/docs/statement/
If Statement helps you, leaving a rating on itch is massively appreciated (it helps the page get seen)!
Requirements
GameMaker 2.3 or later (GML with structs and methods).
Support and feedback
If you run into issues or have ideas for improvements:
- GitHub Issues (bugs and feature requests):
https://github.com/RefresherTowel/Statement/issues - Discord (questions, discussion, show and tell):
https://discord.gg/8spFZdyvkb
Part of the RefresherTowel Games Toolkits
Part of a growing suite of GameMaker tools that are designed to play nicely together. If you like this style of tooling, you might also want:
- Whisper - make your narrative dynamic and reactive, like Hades or Crusader Kings III.
- Catalyst - makes modifiable statistics (and general numbers) super easy.
- Pulse - a signals and events framework (supporting queries that allow you to ask questions instead of just broadcast signals!)
- Statement - a state machine framework (with a fully visual in-game debugger).
- Quill - a FREE text box creator that automatically gives you advanced features like a right click context menu, proper text selection, multi-line text boxes, plus more!
- Fate - a FREE weighted drop system with an easy to use beginner setup, but with a huge amount of advanced features hiding in the weeds.
- Echo - advanced debug logging (level filtering, tags, optional stack traces, history dumps) that now comes with an advanced, yet easy to use debug UI builder!
Get Pulse, Catalyst, Statement and Echo in the Ignition Kit bundle for a discount! Or buy the Full Suite Pass bundle (get access to all past and future tools) in one go!
| Updated | 12 days ago |
| Status | Released |
| Category | Tool |
| Release date | Dec 03, 2025 |
| Rating | Rated 5.0 out of 5 stars (2 total ratings) |
| Author | RefresherTowel |
| Made with | GameMaker |
| Tags | code, finite-state-machine, framework, Game Design, GameMaker, gml, refreshertowel, sourcecode, state-engine, state-machine |
| Links | Documentation, Discord |
| Content | No generative AI was used |
Purchase
In order to download this tool you must purchase it at or above the minimum price of $5.99 USD. You will get access to the following files:
Development log
- To Declaratively Transition Or Not To Declaratively Transition - Statement Updat...31 days ago
- Statement v1.3.5 - Transition data and event handler chaining76 days ago
- Statement v1.3.1 - Minor bugfix82 days ago
- Statement v1.3 - State templates & transition hooks96 days ago
- Statement v1.2 - Statement gives birth to childrenDec 27, 2025
- Statement v1.1 launched! Features Statement Lens: a fully interactable advanced...Dec 10, 2025
- Tutorial: Build a Basic State Machine (in GML)Dec 06, 2025
- Statement Launch!Dec 05, 2025



