[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[pygame] spritecollideany bug?



I'm not sure if these are bugs or outdated docstring.

it says the method returns a sprite or None.. instead it's returning 1 or 0
(replace the 1 with s and 0 with None.. or update the doco)
there's also a mention to dokill argument which doesn't exist, if you add
the dokill arg, be sure to update the doc, as it refers to 'sprites' instead
of 'the single sprite it finds, if any'

here's a copy of the orig method src...

def spritecollideany(sprite, group):
    """pygame.sprite.spritecollideany(sprite, group) -> sprite
       finds any sprites that collide

       given a sprite and a group of sprites, this will
       return return any single sprite that collides with
       with the given sprite. If there are no collisions
       this returns None.

       if you don't need all the features of the
       spritecollide function, this function will be a
       bit quicker.

       all sprites must have a "rect" method, which is a
       rectangle of the sprite area. if the dokill argument
       is true, the sprites that do collide will be
       automatically removed from all groups."""
    spritecollide = sprite.rect.colliderect
    for s in group.sprites():
        if spritecollide(s.rect):
            return 1
    return 0


Alex

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org