[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] Rotation About A Point
Hi,
Rotating creates a new surface, with the original surface drawn at an angle inside it. This means that the original surface is bigger, shifting the middle away.
Compensating runs something as follows:
xdel = int(round( orig_surf_width * sin(radians(rotation_amount)) ))
ydel = int(round( orig_surf_height * cos(radians(rotation_amount)) ))
And then drawing the new surface at (xcoord-xdel,ycoord-ydel).
Ian