lundi 2 mars 2015

pygame rect collision smaller than image

How can I define a rect collision detection smaller than image in pygame? I'd like to have a collision patter like the second image , but I'm having a cut image when a try to set the width and height in the method rect.


enter image description here


When I try to set using image size, I have the collision detection in red



self.rect = pygame.rect.Rect(location, self.image.get_size())


If I set the size using width and height, I just have the third image



self.rect = pygame.rect.Rect(location, (32, 150))


I really wouldn't like to use pixel perfect collision, because is the slowest collision detection, so someone have some idea how can I achieve the second image collision approach using Rect? Thanks.


Aucun commentaire:

Enregistrer un commentaire