Fix relative cursor lifecycle across rounds #75
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "feature/relative-cursor-fixes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
_inputnow guards onMOUSE_MODE_CAPTUREDinstead ofis_instance_valid, preventing cursor_offset from tracking the real mouse after releaseget_first_node_in_group("player")withget_parent().get_parent().get_node("Player")so we always find the player in our own scene instance, not a stale node from the previous round still pendingqueue_free"relative_cursor"group on death so player.gd cannot accidentally pick up the dead cursor on the first frame of a new roundTest plan
Three bugs fixed: 1. Sprite visible after death: _input was still running (only checked is_instance_valid, not mouse mode) and updating cursor_offset from real mouse motion, causing the sprite to track the real cursor. Guard changed to check MOUSE_MODE_CAPTURED instead. 2. Wrong player on second round: get_first_node_in_group("player") could return the old round's player, which is still in the tree when _ready runs (queue_free is deferred). Replaced with a direct scene-relative path lookup (get_parent().get_parent().get_node) which always resolves within the current scene instance. 3. Stale group entry: RelativeCursor stayed in "relative_cursor" group after death, so player.gd could get the dead cursor on the first frame of a new round. Now removed from the group in _on_player_died. Sprite is also hidden there so nothing is visible between rounds. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>