On Wed, Mar 5, 2008 at 11:31 PM, Kris Schnee <[EMAIL PROTECTED]> wrote:

> I tried rotating a ship to build a list of rotated images, but the
> rotated versions are often larger than the original, making it hard to
> figure out where to place them. How can that problem be addressed?

You shouldn't build a list of images unless absolutely necessary.  It will
hurt your performance because of memory issues...

To figure out where to place the ships is easy.
The bliting coordinates specify the position of the top left corner of the
image.  You want to specify the location of the center.  The center of an
image is defined as the point directly between each pair of two sides.  Half
of the distance across and half of the distance down is the center, so:

surface = pygame.transform.rotate(image,80)
size = surface.get_size()
BlitPosition = #Where you want the image to be: e.g. (1,4)
BlitPosition[0] -= size[0]/2.0 #These are negative because the surface must
be moved *away *from the center.
BlitPosition[1] -= size[1]/2.0 #These are negative because the surface must
be moved *away *from the center.

HTH,
Ian

Reply via email to