When I attempt to scale an object, only the top and left of the image get bigger. The rest stays the same. I want an even scale.
import pygame._view
import pygame, sys
from pygame.locals import *
import random
pygame.init()
barrel = pygame.image.load("images\Barrel.gif")
barrelx = 0
barrely = 0
while running:
barrel = pygame.transform.scale(barrel, (int(barrely/4), int(barrely/4)))
screen.blit(barrel, (barrelx, barrely))
barrely is always getting bigger (as a number) until it gets off-screen. I'm using Python 2.7 on Windows XP.
I figured out the problem! The way I wrote the program, the new barrel image was kept being reused. So, right after I displayed the barrel, I put in at the end:
while running:
...
barrel = pygame.transform.scale(barrel, (init(barrely/4),init(barrely/4)))
screen.blit(barrel, (barrelx, barrely))
barrel = pygame.image.load("images\Barrel.gif")
This way, while the scale variable is changing, it affects a fresh image, not a modified image.