-
Notifications
You must be signed in to change notification settings - Fork 360
Closed
Labels
Pycon APAC 2025 SprintsSpecific beginner-friendly issues for PyCon APAC 2025 sprint attendeesSpecific beginner-friendly issues for PyCon APAC 2025 sprint attendees
Description
Enhancement request:
What should be added/changed?
Allow SpriteList.draw_hit_boxes to take RGB colors.
What would it help with?
This splits part of #2066 off:
- an issue for PyCon APAC 2025 as a first-time contribution
- a test of GitHub's new sub-issue feature within Arcade
Proposed implementation:
In this file at this location:
arcade/arcade/sprite_list/sprite_list.py
Lines 1134 to 1146 in 5743504
| def draw_hit_boxes(self, color: RGBA255 = (0, 0, 0, 255), line_thickness: float = 1.0) -> None: | |
| """ | |
| Draw all the hit boxes in this list. | |
| .. warning:: This method is slow and should only be used for debugging. | |
| Args: | |
| color: The color of the hit boxes | |
| line_thickness: The thickness of the lines | |
| """ | |
| # NOTE: Find a way to efficiently draw this | |
| for sprite in self.sprite_list: | |
| sprite.draw_hit_box(color, line_thickness) |
- Change the annotation for
color:- Add an import for
RGBorA255fromarcade.typesto this linearcade/arcade/sprite_list/sprite_list.py
Line 37 in 5743504
from arcade.types import RGBA255, Color, RGBANormalized, RGBOrANormalized - Change the annotation for color to
RGBAorA255
- Add an import for
- Convert and store the
colorargument with a line likeconverted_color = Color.from_iterable(color)- Put it before the for loop (we don't want to re-convert it each time!)
- Pass
converted_colorinstead of color insprite.draw_hit_box(color, line_thickness)
Metadata
Metadata
Assignees
Labels
Pycon APAC 2025 SprintsSpecific beginner-friendly issues for PyCon APAC 2025 sprint attendeesSpecific beginner-friendly issues for PyCon APAC 2025 sprint attendees