[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Flickering Sprite




thanx a lot. it works now, i'm not sure if i did what you meant but it
certainly got me in the right direction!

first i had these two lines, in this order:

self.rect = self.image.get_rect()
self.rect.center = oldcenter

this gives problems because the first line 'reset' the img to the topleft
corner. The second line sets it back where it should be. the trick is, as
i found, to prepare the rect and the center and then apply it in one go.

this is the code that works for me:

newRect = self.image.get_rect()
newRect.center = oldcenter
self.rect = newRect

So, thanks a lot for your help! Will keep you updated of the progress of
my game, it might get fun :D


greets,
Guyon


On Thu, 24 Oct 2002, Peter Goode wrote:

> jus a thought...
> Try setting .rect.center and .rect before .image ?
> not sure - but looks like the sort of thing
>
> P.
>
> gumuz@amoebe.looze.net wrote:
>
> > ok, actually i found the place where it is happening, at least
according to
> > me :).
> >
> > the flickering 'ghost' sprite only appears during a rotation. So the
problem
> > probably is somewhere around here:
> >
> > def update_rotation(self):
> >         oldcenter = self.rect.center
> >         pick = (self.angle % 360) / self.numsteps
> >         self.image = self.rotates[pick]
> >         self.rect = self.image.get_rect()
> >         self.rect.center = oldcenter
> >
> > this code i got form one of the people on this list, can't remember
who it
> > was. is there something wrong with it?
> >
> > thanx,
> > gumuz
> >
> > ----- Original Message -----
> > From: "Guyon Morée" <gumuz@looze.net>
> > To: <pygame-users@seul.org>
> > Sent: Thursday, October 24, 2002 02:40
> > Subject: [pygame] Flickering Sprite
> >
> > ____________________________________
> > pygame mailing list
> > pygame-users@seul.org
> > http://pygame.seul.org
>
> ____________________________________
> pygame mailing list
> pygame-users@seul.org
> http://pygame.seul.org
>




____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org