[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] pygame.transform noob question


docs say: pygame.transform.rotozoom(Surface, angle, zoom) -> Surface

so us it like that:

new_surface = rotozoom( the_surface_you_want_rotated, angle, zoom)
screen.blit(new_surface, (posx, posy))

the_surface_you_want_rotated is like the original surface which does not change.
angle is the angle of rotation
zoom is the zoom factor
new_surface is what rotozoom returns: the rotated and zoomed image :-)

I hope, that helps. Perhaps another image than a circle would be better, because there you would see the rotation ;-) .


paris@xxxxxxxxxxxxxxxxx schrieb:
Hi Pygame List,

I'm new and excited about possibilities with Pygame.
So far, I'm going through the docs trying things out but I'm stuck on

In one of my first experiments, I'm drawing (and redrawing) randomly
placed circles on the screen (code below). I'd like to apply a rotozoom but can't figure out where it goes or maybe
the result of pygame.draw.cirle needs to go to some other surface (not
the main screen) and that is what needs to be rotozoomed?

Any advice would be appreciated!

Thanks and best,


import pygame
import random
from pygame.locals import *

screen = pygame.display.set_mode((320,240))

points = []
for i in range(100):
    xi = random.random() * 1000
    yi = random.random() * 1000
    pointi = (xi,yi)

for i in range(50):
for p in points:
randR = random.randint(0,255)
randG = random.randint(0,255)
randB = random.randint(0,255)
radius = random.randint(1,30)
###doesn't work
#pygame.transform.rotozoom(screen, 45,1.5)