Skip to content

Add the Crosshair extension - #2382

Merged
4ian merged 1 commit into
mainfrom
claude/dreamy-mendel-iw5mn6-crosshair
Nov 27, 2026
Merged

4ian merged 1 commit into
mainfrom
claude/dreamy-mendel-iw5mn6-crosshair

Conversation

@4ian

@4ian 4ian commented Nov 27, 2026

Copy link
Copy Markdown
Collaborator

A crosshair custom object (events only), with 8 ready-to-use variants in the asset store (GDevelop-assets#775).

Crosshairs

Simple to use

  • Its position is its center: the inner area goes from -size/2 to +size/2, so the origin and the center are the same. Put it at the cursor, at the center of the screen or anywhere, without any offset.
  • Follow the mouse or touch (property, on by default), and hide the mouse cursor (property, on by default; the cursor is shown again when the crosshair is deleted). For a first person game, turn off "Follow the mouse or touch" and put it at the center of the screen.

Optional

  • Add spread (action, for example when shooting): the arms move apart and come back by themselves (maximum spread and recovery speed are properties). The Spread expression can make shots less precise.
  • Show the hit marker (action): flashes and fades out (duration as a property).
  • On a target (action and condition): the crosshair takes its "color on a target".
  • Color (property and action): the images are white with a dark outline and are tinted.
  • Follow the mouse or touch (action), to switch to a gamepad or to a fixed position.

How variants are made

  • Center and Ring: sprites with their origin at their center.
  • Arm: one sprite used for every arm. It is turned by its instance angle and moves along the line from its own center to the center of the crosshair when it spreads. This makes crosses, T, X, chevrons, corner brackets or circles made of arcs.
  • HitMarker: a sprite, hidden until the hit marker is shown.

Tests

A gameplay test in GDevelop, on the 8 variants:

  • each one is centered on its position;
  • the arms move apart when shooting and come back;
  • the circle of arcs grows and stays centered;
  • the hit marker shows then fades out;
  • "On a target" works;
  • the crosshair follows the cursor, centered on it.

npm run build, npm test and npm run check-post-build pass.


Generated by Claude Code

@4ian
4ian requested a review from a team as a code owner November 27, 2026 16:07
@4ian
4ian merged commit c361730 into main Nov 27, 2026
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants