Every visual element and gameplay mechanic in a Geometry Dash level is either an object or a trigger. G.js models both asDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/g-js-api/G.js/llms.txt
Use this file to discover all available pages before exploring further.
GJsObject values — plain JavaScript objects with a fluent builder API that lets you set properties, chain modifications, and finally commit the result to your level with a single .add() call.
The GJsObject Interface
All objects and triggers created by G.js share the same GJsObject interface:
| Member | Description |
|---|---|
type | Always 'object'. Useful for distinguishing GJsObjects from other G.js values at runtime. |
obj_props | A dictionary mapping property keys to their current values. You can inspect this at any time. |
.with(prop, value) | Returns a new GJsObject with the given property set. This method is chainable. |
.add() | Commits the object to the level currently being built. Must be called for the object to appear. |
.with() does not mutate the original object — it returns a new GJsObject with the additional property applied, so you can safely reuse a base object.Creating Objects with object(dict)
The object() function takes a dictionary of obj_props keys mapped to values and returns a GJsObject. Use it for any non-trigger GD object such as blocks, spikes, decorations, and text.
.with() calls after object() to layer on extra properties before calling .add():
Creating Triggers with trigger(dict)
The trigger() function has the same signature as object() but is specifically intended for trigger objects. Under the hood, G.js uses this distinction to handle trigger positioning when triggerPositioningAllowed is enabled in your export config.
Converting Strings to Text Objects with .to_obj()
JavaScript strings get a .to_obj() extension method that converts the string into a GD text object and returns a GJsObject. You can then chain .with() to position and group it before calling .add().
The obj_props Dictionary
obj_props is an exported dictionary that maps human-readable property names to their internal GD integer keys. Always use obj_props keys rather than raw numbers so your code stays readable and forward-compatible.
Here are the most commonly used keys:
| Key | Description |
|---|---|
obj_props.OBJ_ID | The object’s GD type ID |
obj_props.X | Horizontal position |
obj_props.Y | Vertical position |
obj_props.GROUPS | Group assignment (single group or array) |
obj_props.ROTATION | Rotation in degrees |
obj_props.COLOR | Primary color channel |
obj_props.COLOR_2 | Secondary color channel |
obj_props.TARGET | Target group (used by many triggers) |
obj_props.DURATION | Trigger duration |
obj_props.MOVE_X | X movement amount (move trigger) |
obj_props.MOVE_Y | Y movement amount (move trigger) |
obj_props.EASING | Easing type |
obj_props.TEXT | Text content (text objects) |
The full list of
obj_props keys is documented in the Object Properties reference.The obj_ids Export
obj_ids is a companion export that maps friendly names to GD object type IDs. Use it as the value for obj_props.OBJ_ID instead of hard-coding integers.
Chaining .with() for Clean Configuration
Because .with() returns a new GJsObject, you can build a base template and derive specialised versions from it:
Adding Objects to the Level
.add() is the final step — nothing appears in your level until it is called. Forgetting .add() is the most common source of “missing objects” bugs.
$.add(...objects) to add multiple pre-built GJsObject values at once.
Full Example
Groups, Colors & Blocks
Learn how to create and use
$group, $color, and $block IDs with their built-in trigger methods.Object Properties Reference
Full listing of every key available in the
obj_props dictionary.