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

Re: [pygame] [Pygame] Joystick Inputs



On Thu, Dec 8, 2011 at 12:36 AM, Ian Mallett <geometrian@xxxxxxxxx> wrote:
Except in the trivial case, the rotated image will still be a different size, of course.  Remember to offset the image correctly (I recommend calling .get_width() and .get_height()) and then subtracting half that from your player's position to get draw coordinates.

Right, you want the image to be centered on the player's position. I think the clearest way to do it is using pygame.Rect's handy positioning:

rect = self.image.get_rect(center = (self.x, self.y))
screen.blit(self.image, rect)

-Christopher