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

Re: [pygame] Problems with moving animated images



On 4/8/06, Juha <sj.m@xxxxxxxxxxx> wrote:
> I forgot to show the sprite's move method, so here goes:
>
>     def move(self, pos):
>         self.frect = self.frect.move(pos.getX(), pos.getY())
>         self.rect = self.rect.move(pos.getX(), pos.getY())
>         x = self.pos.getX() + pos.getX()
>         y = self.pos.getY() + pos.getY()
>         self.pos.set(x, y)
>
Looks like you are modifying the src rect (self.frect) when moving, I
don't think you want to do that (the src rect should be relative to
the large surface, not relative to the screen)

also, you don't need to use a rect for the destination position of the
blit - a 2 element position is all you need (surface.blit ignores the
destination rect width & height if you pass a rect)