On Wed, Dec 7, 2011 at 5:49 PM, Andrew Godfroy <killer...@hotmail.com>wrote:

>                 self.image = pygame.transform.rotate (self.image,
> -angle_degrees)
>
Your problem is here.

1: You'll get some sort of markov-chain-esque decay of your image's quality
(because you're constantly rotating the image that you already rotated,
which was itself a rotation of the image you previously rotated of the
rotated . . .).

2: The rotate function rotates the given surface, padding with empty space.
 So, if you rotate a 512x512 image 30 degrees, then basic geometry tells
you the resulting image will be close to 700 pixels on a side (the rotated
image will be in the middle).  This explains why the character appears to
shoot off the screen; you're constantly rotating him, and the surface
required to contain that surface keeps getting bigger, because you're
setting it to itself.  The player appears to move offscreen, because he's
in the center of a surface that's effectively rapidly increasing in size.
 Because of that, you'll natually get that running-out-of-memory problem,
too.

Ian

Reply via email to