From 2b6f846bdd9c3a02e78e6f64e72f54f27a6d5553 Mon Sep 17 00:00:00 2001 From: celeritydesign Date: Sun, 27 Oct 2024 16:13:00 +0000 Subject: [PATCH] Docs update for optional collide arg 'ignore_self' --- docs/reST/ref/sprite.rst | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/docs/reST/ref/sprite.rst b/docs/reST/ref/sprite.rst index 268727a1d0..e7fc720d83 100644 --- a/docs/reST/ref/sprite.rst +++ b/docs/reST/ref/sprite.rst @@ -644,7 +644,7 @@ Sprites are not thread safe. So lock them yourself if using threads. .. function:: spritecollide | :sl:`Find sprites in a group that intersect another sprite.` - | :sg:`spritecollide(sprite, group, dokill, collided = None) -> Sprite_list` + | :sg:`spritecollide(sprite, group, dokill, collided = None, ignore_self = False) -> Sprite_list` Return a list containing all Sprites in a Group that intersect with another Sprite. Intersection is determined by comparing the ``Sprite.rect`` @@ -659,6 +659,10 @@ Sprites are not thread safe. So lock them yourself if using threads. sprites must have a "rect" value, which is a rectangle of the sprite area, which will be used to calculate the collision. + The ignore_self argument is a bool. If set to True, the sprite will not + register a collision with itself, even if it is contained within the group + being tested. + collided callables: :: @@ -825,14 +829,14 @@ Sprites are not thread safe. So lock them yourself if using threads. .. function:: spritecollideany | :sl:`Simple test if a sprite intersects anything in a group.` - | :sg:`spritecollideany(sprite, group, collided = None) -> Sprite` Collision with the returned sprite. - | :sg:`spritecollideany(sprite, group, collided = None) -> None` No collision + | :sg:`spritecollideany(sprite, group, collided = None, ignore_self = False) -> Sprite` Collision with the returned sprite. + | :sg:`spritecollideany(sprite, group, collided = None, ignore_self = False) -> None` No collision If the sprite collides with any single sprite in the group, a single sprite from the group is returned. On no collision None is returned. If you don't need all the features of the ``pygame.sprite.spritecollide()`` function, this - function will be a bit quicker. + function will be a bit quicker.. The collided argument is a callback function used to calculate if two sprites are colliding. It should take two sprites as values and return a bool value @@ -840,6 +844,10 @@ Sprites are not thread safe. So lock them yourself if using threads. sprites must have a "rect" value, which is a rectangle of the sprite area, which will be used to calculate the collision. + The ignore_self argument is a bool. If set to True, the sprite will not + register a collision with itself, even if it is contained within the group + being tested. + .. ## pygame.sprite.spritecollideany ## .. ## ##