Rule
0 installs · 0 said it worked
Cursor rules for writing maintainable GameMaker GML code
A Cursor rules file guiding GML game code: event organization, naming, state machines, performance, debugging, and common mistakes to avoid in GameMaker projects.
People use this for
- gamemaker gml code style
- gml game object organization
- cursor rules gamemaker
- gamemaker state machine code
- write maintainable gml game scripts
- Name
cursor-rules-for-writing-maintainable-gamemaker-gml-code- Works with
- Cursor
- License
- CC0(as observed at the source)
- Version
- v1 · updated Nov 29, 2026
Imported on Nov 29, 2026 from github.com . License observed at the source on Nov 29, 2026: CC0.
Are you the author?Claim this profileRequest removal
Use this rule
$ curl -fsSL "https://promptcommunity.dev/api/v1/posts/cursor-rules-for-writing-maintainable-gamemaker-gml-code-49j4/export/mdc" -o .cursor/rules/cursor-rules-for-writing-maintainable-gamemaker-gml-code.mdcThen open a new session; Cursor picks it up from .cursor/rules/.
Manual install
Save cursor-rules-for-writing-maintainable-gamemaker-gml-code.mdc as .cursor/rules/cursor-rules-for-writing-maintainable-gamemaker-gml-code.mdc for this project or ~/.cursor/rules/cursor-rules-for-writing-maintainable-gamemaker-gml-code.mdc for every project, then start a new session.
Rule
description: GameMaker Language (GML) rules for scripts, objects, events, rooms, data structures, and performance-minded game code globs: ["/*.gml", "/.yy", "**/.yyp"] alwaysApply: false
GameMaker GML Rules
Code Organization
- Keep object event code short and move reusable behavior into scripts or functions.
- Use clear prefixes or naming conventions for scripts, objects, sprites, rooms, and globals.
- Prefer functions over copy-pasted event blocks.
- Keep create-step-draw responsibilities separate.
- Put initialization in Create, simulation in Step, and rendering-only work in Draw.
GML Style
- Use descriptive variable names and avoid one-letter names outside small loops.
- Prefer local variables with
varor function-scoped declarations over unnecessary instance variables. - Use constants, enums, and macros for repeated identifiers, layer names, states, and collision groups.
- Guard optional instance references with
instance_exists. - Keep global state minimal and document it.
Gameplay Architecture
- Use finite state machines for player, enemy, UI, and game-flow states.
- Keep collision logic explicit and deterministic.
- Separate input collection from action execution.
- Use alarms, timelines, or explicit timers consistently; do not mix patterns without reason.
- Store save data through structured maps/structs and version the save format.
Performance
- Avoid expensive searches such as broad
instance_findor repeated collision scans in every Step event. - Cache frequently used asset IDs, layer IDs, and object references when safe.
- Destroy data structures when no longer needed.
- Use object pooling for frequent projectiles, particles, or short-lived effects when allocation becomes costly.
- Profile before optimizing and keep hot-path code simple.
Debugging and Testing
- Add debug overlays for collision boxes, state, velocity, and AI decisions when useful.
- Use assertions or explicit guard clauses for impossible states.
- Test room transitions, pause/resume, save/load, and controller/keyboard input separately.
- Keep reproducible test rooms for complex mechanics.
Common Mistakes
- Do not put game logic in Draw events.
- Do not create data structures without destroying them.
- Do not rely on room editor instance order for critical behavior.
- Do not hardcode magic numeric state IDs.
No result recorded yet. Added it? File a Tried-it report so the next person knows how it went in your editor.
Tried it
Reports from people who added this rule to their editor. They roll up into the badges above.
No one has filed a report yet. Try the prompt and be the first.
Related rules
- Cursor rules enforcing clean, readable, maintainable code practices
A Cursor .mdc rule file that guides the assistant toward clean code: named constants, meaningful names, sparing comments, single-purpose functions, DRY, language style standards, extracted conditionals, continuous refactoring, and version control.
Coding · @patrickjs
- Explain, test, and harden a Python regular expression
Explains a Python regex token by token, tests it against must-match and must-not-match samples, flags risky patterns like catastrophic backtracking, and returns a safer rewrite with a test table.
Coding · @f
- Claude api: reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming,…
Reference for the Claude API / Anthropic SDK — model ids, pricing, params, streaming, tool use, MCP, agents, caching, token counting, model migration. TRIGGER — read BEFORE opening the target file; don't skip because it "looks like a one-liner" — whenever: the prompt names Claude/Anthropic in any fo
Coding · @anthropic
- Find silent exception-handling smells in Python code
Scans Python files offline with ast to flag bare or swallowed excepts, silent fallbacks, lost causes, and other error-hiding patterns, returning file:line findings with severity and fix recipes.
Coding · @f
- Nginx config security review with fixes and checker script
Agent skill that reviews nginx configs for TLS, header, alias traversal, admin exposure and rate-limit problems, runs a stdlib checker, and returns a minimal route-preserving fixed config with reload and curl test steps.
Coding · @f
License: CC0v1 · published Nov 29, 2026
Comments
No comments yet. If you tried this prompt, say how it went.