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

Re: [pygame] [pygame ] Having trouble with RenderUpdate



Hi KKarasu.

> self.rect=(self.image.get_rect()).move(self.posicao[0],self.posicao[1]) # this moves the object by messing with the rect

it probably doesn't move the object.

What it does is:

self.image.get_rect() # create a new Rect from image data (this will
always be at x=0,y=0)

.move(self.posicao[0],self.posicao[1]) # create a new Rect that has
the width and height of the image, but that has x=0+posicao[0],
y=0+posicao[1]

So if you're expecting self.image.get_rect() to know about the
sprite's position, it doesn't.  I assume "posicao" is some kind of
velocity vector.

On Sun, Sep 14, 2008 at 5:47 PM, KKarasu <catsareninja@xxxxxxxxx> wrote:
> Hi there!
> Im new in this mailing list thingys i just didnt get the reply from the
> server to authenticate, so i am sending it again but with [pygame] on the
> subject i didnt send it the first time.
>
> After reading a couple of tutorials i just don't get how to clear just the
> area the sprite changed.
>
> exemple: i have an arrow, i blit it on the screen with a group.draw, and i
> dont know how to just update the area that changed by this method. i could
> blit again the entire screen, but i just want that spot, that way i dont
> have to blother bliting a hole lot of other stuff.
>
> # this is just the method part the rest is uninportant
>
> def start(self):
>
> self.rect=(self.image.get_rect()).move(self.posicao[0],self.posicao[1]) #
> this moves the object by messing with the rect
>
>        a=R_up.draw(screen)  #this draws the group sprites  (R_up= thats
> RenderUpdate group)
> #iundestand that returns the changed areas so it says in the docs i should
> pass it to pygame.display.update
> #so thats what i do
>   pygame.display.update(a)
>
>
> so it doesnt work.
> can anyone explainme how to do this?
>