'Is it possible to proportionally scale an image in Pygame so that it scales from the middle? [duplicate]
I’m currently trying to make an interactive button that grows when you hover over it with the mouse. As of right now, all that happens is that the width and height increase by 100, but this causes the image to be out of proportion and also grow toward the right because the anchor point is at the top left like with all Pygame sprites. How could I make it so the image grows proportionally to itself from the middle?
Here is what I have currently (width and height is 490x44 and they are passed as parameters)
self.image = pygame.transform.smoothscale(self.image,((self.width + 100), (self.height + 100)))
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
