Mouse¶
Category: Listener Tier: Basic
Purpose¶
Detects mouse buttons, movement, wheel, and hover events.
Visual Reference¶

When To Use¶
Follow-mouse and strafe-style 2D control graphs.
Capture mouse position into variables for indirect targeting.
Read wheel and delta values into gameplay logic without custom code.
Feed
{prefix}_world_2dor{prefix}_positiondirectly intoServoor intoTrack Toposition-variable mode for top-down/tower-style targeting.
Runtime Behavior¶
Triggers: Based on the selected mouse event and input mode.
Buttons support
While Held,On Press, andOn Release.Movement and wheel events use the runtime
mouse_statecache.Hover supports both
Mouse OverandMouse Over Any.invert=trueflips the final active state like other listeners.
Properties¶
Property |
Type |
Default |
Notes |
|---|---|---|---|
Event |
option |
Left Button |
Type of mouse event to detect |
Input |
option |
On Press |
When to trigger (for button events) |
Tap Mode |
bool |
False |
Trigger once per click (prevents multi-firing). Enable for single-click behavior |
Move Thresh |
float |
1.0 |
Minimum pixel movement to trigger (for Movement events) |
Wheel Sens |
float |
1.0 |
Wheel scroll sensitivity multiplier (for Wheel events) |
Expose Data |
bool |
False |
Write mouse position, world position, delta, and wheel values into variables |
Expose Scope |
option |
Local |
Where exposed mouse variables are written |
Position Var |
variable_name |
Variable that receives screen/viewport mouse position |
|
World2D Var |
variable_name |
Variable that receives 2D world mouse position |
|
Delta Var |
variable_name |
Variable that receives mouse delta |
|
Wheel Var |
variable_name |
Variable that receives wheel delta |
|
X Var |
variable_name |
Variable that receives mouse screen X |
|
Y Var |
variable_name |
Variable that receives mouse screen Y |
|
World X Var |
variable_name |
Variable that receives 2D world X |
|
World Y Var |
variable_name |
Variable that receives 2D world Y |
|
Delta X Var |
variable_name |
Variable that receives mouse delta X |
|
Delta Y Var |
variable_name |
Variable that receives mouse delta Y |
|
Expose Prefix |
string |
mouse |
Compatibility fallback when explicit output variables are empty |
Lock Center |
bool |
False |
Capture mouse to center (FPS Mode) |
Confine |
bool |
False |
Keep mouse within window (RTS Mode) |
Notes¶
Native implementation:
src/listeners/mouse_listener.cppgdlink_runtime.gdmaintainsmouse_statewith:mouse_positionmouse_position_world_2dmouse_deltawheel_delta
mouse_positionandmouse_position_world_2dare refreshed every runtime tick, not only on mouse motion, so Camera2D zoom/offset and viewport changes remain reflected in exposed variables.Exposed values are sampled every tick when
expose_mouse_data=true, even if the selected mouse event is not currently firing. Event firing still controls whether the listener output passes to gates.