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

Re: [pygame] Changing the size of a sprite



What is your draw method?

--- John Hopkin <john.hopkin@brookview.karoo.co.uk> wrote:
> 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?


=====
"'Beware of the man who works hard to learn something, learns it, and finds himself no wiser than before,' Bokonon tells us. 'He is full of murderous resentment of people who are ignorant without having come by their ignorance the hard way.'" -- Kurt Vonnegut, "Cat's Cradle"

__________________________________
Do you Yahoo!?
The New Yahoo! Shopping - with improved product search
http://shopping.yahoo.com