0

我希望我的精灵的碰撞区域小于它的矩形。例如:

sprite = pygame.sprite.Sprite()
image = pygame.surface.Surface((100, 100))
image.fill((0,0,0))
sprite.image = image
sprite.rect = image.get_rect()
# I would like that collision methods use this rect
sprite.collision_rect = image.get_rect()
sprite.collision_rect.width = 10  

可能吗?

4

1 回答 1

0

当然,您可以简单地使用:

sprite.collision_rect.colliderect(other.collision_rect)    # returns True if they collide
于 2013-06-14T17:47:42.497 回答