Skip to content

check_for_collision: Trigger spritelist init if needed#2662

Merged
einarf merged 1 commit into
developmentfrom
lazy-col-fix
May 3, 2025
Merged

check_for_collision: Trigger spritelist init if needed#2662
einarf merged 1 commit into
developmentfrom
lazy-col-fix

Conversation

@einarf
Copy link
Copy Markdown
Member

@einarf einarf commented May 3, 2025

Initialize lazy spritelists if needed when gpu collision is selected

#2661

@einarf einarf marked this pull request as ready for review May 3, 2025 18:23
@einarf einarf requested a review from Copilot May 3, 2025 18:31
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR ensures that lazy spritelists are initialized when required during GPU collision checks. Key changes include:

  • Adding a new test to confirm spritelist initialization on GPU collision.
  • Updating the geometry property in SpriteList to call initialize() automatically.
  • Adjusting the collision module to use the geometry property instead of a direct _geometry attribute.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.

File Description
tests/unit/sprite/test_sprite_collision.py Adds a new test to verify initialization of a lazy spritelist.
arcade/sprite_list/sprite_list.py Changes the geometry property check to call initialize() if needed.
arcade/sprite_list/collision.py Uses the geometry property for collision transform instead of _geometry.
Comments suppressed due to low confidence (1)

tests/unit/sprite/test_sprite_collision.py:320

  • Typo in the docstring: 'his' should be corrected to 'is'.
This ensures that check_for_collision_with_list() will trigger a spritelist initialization if his is not done yet.

@einarf einarf merged commit d015e81 into development May 3, 2025
8 checks passed
@einarf einarf deleted the lazy-col-fix branch May 3, 2025 18:32
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