Disclosure: This draft was generated with AI and checked against the cited primary sources, with a separate AI editorial review. It was prepared for the FrameSprite team, which has a commercial interest in FrameSprite. Proposed examples are not executed tests unless explicitly identified as recorded fixture results.
Pass a world-space point interpreted through the correct camera to HaxeFlixel pixelsOverlapPoint. Although the input is a world point, the method evaluates displayed pixels with camera-related transformations. A HUD sprite and a world sprite can therefore disagree when the pointer is converted using the wrong view. See the FlxSprite point-query contract.
Key Takeaways
- Identify the camera drawing the queried sprite.
- Do not manually add scroll and then call another conversion that adds it again.
- Choose an alpha tolerance consistent with the desired interaction area.
Identify the two coordinate domains
A fixed HUD icon can share artwork with an icon placed in the scrolling world. They do not necessarily share the same camera or scroll factor. The mouse's default world position may correspond to the main camera while the HUD is drawn by another.
The FlxMouse API provides camera-specific position conversion. Record the selected camera, its scroll and the point passed into the query. A constant correction that works at one camera position is evidence that a conversion boundary still needs attention.
For general interaction policy, the alpha-aware picking guide explains when visual pixels should define selection and when a simple button rectangle is clearer.
Convert once for the chosen camera
An illustrative query path is:
// HaxeFlixel 6.x API fragment; not executed here.
var worldPoint = FlxG.mouse.getWorldPosition(hudCamera);
var hit = icon.pixelsOverlapPoint(worldPoint, 0x80, hudCamera);
// Release or reuse point storage according to the project's FlxPoint policy.
The sample tolerance is a deliberate example, not a universal threshold. Review the method's alphaTolerance behavior against your artwork and supported target. Do not interpret it as a geometric collision setting.
If the sprite's scrollFactor differs from the surrounding world, let the documented method account for its display transformation. Avoid hand-applying scrollFactor and then asking the query to apply it again.
Separate box hits from pixel hits
A rectangular overlap can correctly return true at a transparent corner. A pixel query may return false there by design. Log both only when that difference helps establish the intended behavior; do not require them to agree everywhere.
The FlxCamera reference describes the view's scroll and viewport. A split-screen or inset camera should be tested near every viewport edge, where a wrong view selection is easier to notice.
| Test location | What it reveals |
|---|---|
| Opaque center | Basic point and camera agreement |
| Transparent canvas corner | Box-versus-pixel policy |
| Semi-transparent edge | Alpha-tolerance policy |
| Same icon after camera scroll | Coordinate conversion ownership |
Small icons also need a usability decision. Strictly rejecting every translucent edge can make selection harder even if it matches the image technically. The small-inventory-icon guide helps evaluate the visible target at final size.
Acceptance with two cameras
Place one icon in the world and another on a fixed HUD. Scroll the world, zoom its camera and resize the window. Query each icon with its own selected view and verify the intended hit region.
Test an asymmetric image so a wrong axis or offset remains visible. Save the camera, point domain and tolerance in the delivery checklist.
No pointer interaction was run for this article. It targets the linked HaxeFlixel 6.x API snapshot checked October 20, 2026; older position-conversion names require a version-specific review.
Choose a stable target when artwork animates
An animated icon can change its opaque silhouette while the pointer remains stationary. Decide whether hover should follow those changing pixels or remain on the control's stable interaction region. Strict pixel picking may be appropriate for selecting an irregular object, while a button often benefits from predictable bounds. Test the most transparent and most extended frames before adopting the pixel policy. The coordinate fix makes the query accurate; it does not decide which changing visual shapes should control the user's ability to click.
Sources and editorial ownership
Primary references checked on October 20, 2026:
- Pixel point-query coordinates and tolerance
- Camera-specific pointer conversion
- Camera scroll and viewport
Editorial owner: FrameSprite Workflow Team. Editorial and verification policy. Report a documentation correction.
Top comments (0)