Skip to content

Fix the type signature of collision check methods. #2578

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions arcade/sprite/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ def collides_with_point(self, point: Point2) -> bool:
x, y = point
return is_point_in_polygon(x, y, self.hit_box.get_adjusted_points())

def collides_with_sprite(self: SpriteType, other: SpriteType) -> bool:
def collides_with_sprite(self, other: BasicSprite) -> bool:
"""Will check if a sprite is overlapping (colliding) another Sprite.

Args:
Expand All @@ -813,7 +813,7 @@ def collides_with_sprite(self: SpriteType, other: SpriteType) -> bool:

return check_for_collision(self, other)

def collides_with_list(self: SpriteType, sprite_list: "SpriteList") -> list[SpriteType]:
def collides_with_list(self, sprite_list: SpriteList[SpriteType]) -> list[SpriteType]:
"""Check if current sprite is overlapping with any other sprite in a list

Args:
Expand Down
4 changes: 2 additions & 2 deletions arcade/sprite_list/collision.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ def _get_nearby_sprites(


def check_for_collision_with_list(
sprite: SpriteType,
sprite_list: SpriteList,
sprite: BasicSprite,
sprite_list: SpriteList[SpriteType],
method: int = 0,
) -> List[SpriteType]:
"""
Expand Down
Loading