General purpose trigger functions cover the most commonly used GD trigger types: camera control, color changes, movement, audio, particles, randomness, gravity, player input, and level endings. Most functions add their trigger to the level automatically; functions that return aDocumentation 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 require you to call .add() explicitly.
Camera Triggers
camera_offset
Moves the camera by(x, y) over an optional duration.
Horizontal offset in GD units.
Vertical offset in GD units.
Seconds the camera takes to reach the offset position.
camera_static
Locks the camera to a target object (group). Useful for cinematic scenes.Group containing the object to center the camera on.
Time for the camera to move to the target.
Easing constant.
Controls how smoothly the effect starts.
Instantly stops the static camera.
Stops the static camera with a transition.
Adapts the camera transition to the current camera velocity. No easing recommended when enabled.
Modifier for the smooth velocity effect.
Makes the camera update continuously as the object moves.
Restrict locking to the X axis only.
Restrict locking to the Y axis only.
camera_zoom
Zooms the camera in or out.Zoom multiplier. Values above 1 zoom in; below 1 zoom out.
Seconds to reach the target zoom level.
Easing constant.
camera_mode
Toggles free-camera mode and optionally edits camera movement settings.Enable (
true) or disable (false) free camera mode.Remove the default snapping to the nearest grid space.
Enable editing of camera easing and padding values.
Camera movement easing. Only applied when
edit_cam is true.Camera movement padding. Only applied when
edit_cam is true.camera_rotate
Rotates the camera by the specified degrees.Degrees to rotate the camera.
Duration of the rotation.
Easing constant.
Add the input rotation to the current camera rotation instead of setting it absolutely.
Convert the rotation to the nearest multiple of 360°.
camera_edge
Pins one of the camera’s edges to a target object.Group ID of the target object to use as the edge anchor.
Which edge to pin. Use
LEFT_EDGE, RIGHT_EDGE, UP_EDGE, or DOWN_EDGE (see Constants).Color Triggers
color_trigger
Sets a color channel to an RGB value over a duration and returns the trigger object.Color channel to modify. Can be a
$color or a channel constant like BG, GROUND, etc.Red component (0–255).
Green component (0–255).
Blue component (0–255).
Seconds to transition to the new color.
Opacity of the channel (0 = invisible, 1 = fully visible).
Enable additive blending for this color.
GJsObject — call .add().
toggle_on_trigger
Returns a toggle trigger that activates the specified group.Group to activate.
GJsObject — call .add().
toggle_off_trigger
Returns a toggle trigger that deactivates the specified group.Group to deactivate.
GJsObject — call .add().
hide_player
Hides the player sprite.gradient
Creates a gradient trigger spanning four vertex groups and returns it.First color of the gradient.
Second color of the gradient.
Bottom-left vertex group.
Bottom-right vertex group.
Top-left vertex group.
Top-right vertex group.
Use vertex mode.
Enable blending on the gradient.
Gradient layer (0–15).
GJsObject — call .add().
Movement Triggers
move_trigger
Returns a move trigger that displaces a group by(x, y).
Group ID of the object(s) to move.
Horizontal displacement in GD units.
Vertical displacement in GD units.
GJsObject — call .add().
teleport
Teleports the player to a target group or[x, y] coordinate pair.
Group ID of the target object, or an
[x, y] coordinate array.Pass
true to suppress the teleport visual effect.timewarp
Warps all time in the level by a multiplier. Values above 1 speed up; below 1 slow down.Time warp multiplier.
Song & Audio
song
Plays a song in-game and returns the trigger object. Supports looping, fading, and channel assignment.Song ID in-game.
Loop the song.
Preload before playing.
Audio channel (0–3).
Playback volume (0–1).
Playback speed offset.
Start position in milliseconds.
End position in milliseconds (0 = play to end).
Fade-in duration in seconds.
Fade-out duration in seconds.
GJsObject — call .add().
Player Triggers
hide_player
See Color Triggers → hide_player.player_control
Restricts player movement abilities for one or both players.Apply restrictions to Player 1.
Apply restrictions to Player 2.
Disable jumping.
Disable movement.
Disable rotation.
Disable sliding.
gravity
Applies a gravity trigger to change the direction or magnitude of gravity.Gravity magnitude.
Only affect Player 1.
Only affect Player 2.
Only affect the player that touches the trigger.
end
Ends the level.End the level immediately without a transition.
Suppress end effects.
Suppress end SFX.
Group to spawn at level end.
Object defining the end position.
options
Returns anOptionsTrigger object with toggle methods for various level-wide display and gameplay flags. Call .add() on the trigger after configuring it.
OptionsTrigger interface exposes the following boolean toggle methods:
| Method | Description |
|---|---|
STREAK_ADDITIVE(v?) | Enable additive streak blending |
HIDE_GROUND(v?) | Hide the ground |
HIDE_MG(v?) | Hide the middleground |
HIDE_P1(v?) | Hide Player 1 |
HIDE_P2(v?) | Hide Player 2 |
DISABLE_CONTROLS_P1(v?) | Disable P1 controls |
DISABLE_CONTROLS_P2(v?) | Disable P2 controls |
UNLINK_DUAL_GRAVITY(v?) | Unlink gravity between players |
HIDE_ATTEMPTS(v?) | Hide the attempt counter |
AUDIO_ON_DEATH(v?) | Play audio on death |
NO_DEATH_SFX(v?) | Suppress death SFX |
RESPAWN_TIME(v) | Set respawn delay (seconds) |
add() | Place the options trigger in the level |
Particles
particle_system
Creates a particle emitter object and returns it.Dictionary of particle system properties.
Inherit the object’s color.
Only start emitting when an Animate trigger activates this object.
Restricts
animate_on_trigger to only work when the object is active.Instantly achieve steady-state emission instead of a gradual ramp-up.
GJsObject — call .add().
spawn_particle
Spawns an existing particle system at a target location.Group ID of the particle system to spawn.
Target location group. Defaults to
group(0).X offset from the target position.
Y offset from the target position.
Scale of the spawned system.
Random scale variance.
Rotation in degrees.
Random rotation variance.
Random X spawn area size.
Random Y spawn area size.
Match rotation across multiple particles.
Miscellaneous
random
Calls one of two groups with a specified chance.First group to potentially call.
Second group to potentially call.
Percentage chance (0–100) that
gr1 is called.advanced_random
Calls one group from a weighted list of[group, weight] pairs.
Rest parameter of
[group, weight] pairs. Weights do not need to sum to 100.