Skip to content

Drop the ignored hit_box_algorithm="None" from the card game tutorial - #2953

Merged
pvcraven merged 1 commit into
developmentfrom
docs/card-game-hit-box
Oct 8, 2026
Merged

pvcraven merged 1 commit into
developmentfrom
docs/card-game-hit-box

Conversation

@pvcraven

@pvcraven pvcraven commented Oct 8, 2026

Copy link
Copy Markdown
Member

Summary

The card game tutorial passed hit_box_algorithm="None" to Sprite in 11 files:

super().__init__(self.image_file_name, scale, hit_box_algorithm="None")

That was Arcade 2's way to use the whole image as the hit box instead of calculating one (it was added in 2021 for #814). Sprite now takes its hit box from the texture and accepts **kwargs without checking them, so the argument has silently done nothing. Found while triaging issues; there was no issue for it.

Changes

  • The 11 files: the argument is removed from each line. Every edit is on the same line, so the tutorial's line-numbered includes still match.

  • The tutorial text: it said "we don't need to go through the time consuming hit box calculation. Therefore we turn that off. Otherwise loading the sprites would take a long time." That's no longer true:

    Hit box Load all 52 cards Points (ace of clubs)
    Default (simple) 43 ms 8: the card's outline, with the rounded corners cut
    Bounding box 37 ms 4

    The paragraph now says Arcade works out each card's hit box from its image, and that the tutorial uses it later to find the card the mouse clicks on (get_sprites_at_point).

Not changed

Sprite still silently ignores keyword arguments it doesn't know, which is how this went unnoticed. Making it warn or raise would change behavior for subclasses and user code, so that's a separate decision.

Checks

  • solitaire_02, solitaire_07, solitaire_11 and drag_drop_cards_full run.
  • The diff changes 11 lines in the code files, one each, and the paragraph in index.rst.

The changelog has an entry under Unreleased → Misc Changes.

🤖 Generated with Claude Code

The card game tutorial passed hit_box_algorithm="None" to Sprite in 11
files. That was Arcade 2's way to use a rectangle instead of computing
a hit box, but Sprite now takes the hit box from its texture and
silently ignores the argument. The text explaining it said hit box
calculation was slow; all 52 cards load with their default hit boxes
in about 40 ms. Removed in place, so the tutorial's line numbers don't
move.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@pvcraven
pvcraven force-pushed the docs/card-game-hit-box branch from 8827353 to b004c90 Compare October 8, 2026 18:22
@pvcraven
pvcraven merged commit a8de62e into development Oct 8, 2026
7 checks passed
@pvcraven
pvcraven deleted the docs/card-game-hit-box branch October 8, 2026 18:50
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.

1 participant