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

RE: [pygame] pygame.transform noob question



Thanks for the quick reply!

It's a bunch of circles and yeah, this does it just fine now!

Best,
p



> -------- Original Message --------
> Subject: Re: [pygame] pygame.transform noob question
> From: DR0ID <dr0id@xxxxxxxxxx>
> Date: Tue, March 13, 2007 12:25 pm
> To: pygame-users@xxxxxxxx
> 
> hi
> 
> docs say: pygame.transform.rotozoom(Surface, angle, zoom) -> Surface
> 
> so us it like that:
> 
> ---code---
> ...
> new_surface = rotozoom( the_surface_you_want_rotated, angle, zoom)
> screen.blit(new_surface, (posx, posy))
> ...
> ---code---
> 
> 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 ;-) .
> 
> ~DR0ID
> 
> 
> 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
> > pygame.transfom
> >
> > 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,
> > Paris
> >
> > -----------------------------------------
> >
> > import pygame
> > import random
> > from pygame.locals import *
> >
> > pygame.init()
> > screen = pygame.display.set_mode((320,240))
> > screen.fill((0,0,0))
> >
> > points = []
> > for i in range(100):
> >     xi = random.random() * 1000
> >     yi = random.random() * 1000
> >     pointi = (xi,yi)
> >     points.append(pointi)
> >
> > 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)
> >         pygame.draw.circle(screen,(randR,randG,randB),p,radius,0)
> >         
> >     ###doesn't work
> >     #pygame.transform.rotozoom(screen, 45,1.5)
> >     pygame.display.flip()
> >     
> >
> > pygame.quit()
> >
> >
> >
> >
> >