To preserve the center:

    pos = self.rect.center
    self.rect = self.rect.inflate(-85, -20)
    self.rect.center = pos





On Thu, May 22, 2014 at 5:47 AM, Skorpio <skorpio2...@yahoo.de> wrote:

> Hi everybody,
>
> How can you scale the hitbox of a sprite? I tried self.rect =
> self.rect.inflate(-85, -20) and that scaled the rect correctly (to the
> center of the rect), but the game still takes the upper left corner of the
> rect as the blit position for the image/surface. That means the rect covers
> only the upper left part of the sprite, so that the left half of the sprite
> image can be hit and the right half can't be hit.
>
> Regards,
> Skorpio
>
>
>
> --
> View this message in context:
> http://pygame-users.25799.x6.nabble.com/pygame-Scaling-the-hitbox-rect-of-a-sprite-tp1227.html
> Sent from the pygame-users mailing list archive at Nabble.com.
>



-- 
Jake

Reply via email to