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

[pygame] Changing the size of a sprite



I'm a newbie to pygame (and to Python), so please bear with me.

I'm trying to change the size and position of a sprite in its "update"
method - the position changes fine, but the size stays the same.
Here's the code:

    def update(self):
        mapx,mapy,mapsize = self.map.PositionAnimal(self.x,self.y)
        self.rect.topleft = mapx, mapy
        self.rect.width = mapsize
        self.rect.height = mapsize
        print "updated:", self.rect.width

The PositionAnimal function returns the new position and size of the
sprite, and the debug print at the end reflects the new size.  The
sprite moves when PositionAnimal tells it to, but stays the same size.

Am I missing something here?  Have I provided enough information?