[Tutor] Position issue with Pygame
Greg Nielsen
gollumgreg407366 at gmail.com
Tue Mar 13 18:00:45 CET 2012
Hey everyone,
Still working on that racing game project. I have come quite a far way
and will hopefully release something soon, but I wrote some bad code and
can't seem to fix it. Im most likely just missing something really silly
because I wrote this code at 2am yesterday. Here it is
def __init__(self):
pygame.sprite.Sprite.__init__(self)
"""Set the image, convert the image, and set the rect"""
self.image = pygame.image.load("NoCondition.bmp")
self.image = self.image.convert()
self.rect = self.image.get_rect()
"""Set the position of the sprite on screen"""
self.center = (100, 100)
self.rect.center = self.center
For whatever reason, the sprite is placed at the very top of the
screen as if assigned "self.rect.topleft = (0, 0)" reguardless of what I
assign as the position. Please put me out of my misery and point out what
little thing I coded wrong. Thank you all for the help.
Greg
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20120313/935c04a9/attachment.html>
More information about the Tutor
mailing list