我希望我的精灵的碰撞区域比它的矩形小。 例如:
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
有可能吗?
答案 0 :(得分:0)
当然,你可以简单地使用:
sprite.collision_rect.colliderect(other.collision_rect) # returns True if they collide