using self.rect = image.get_rect() gets you a rect with the correct size. you can use self.rect.topleft = (100, 200) to set the position, that will save you some lines.
saw this second e-mail only after replying to the first one. sorry.
On Mon, Sep 15, 2008 at 9:16 AM, KKarasu
<catsareninja@xxxxxxxxx> wrote:
Thanks Andy.
I think i understood.the get rect always returned at (0,0) and that was a problem.
so basicaly my code did was: create surface at 0,0 and move it to posicao=[x,y] (yes posicao is position i used my own language variables and forgot to translate, sorry)
then draw it with group.draw, updating the (0,0) surface,right?
what happened was this: http://kkarasu.deviantart.com/art/second-title-screen-97971437 #tìs my devart site, it got the screen shot there
So i need to keep track of where the surface is at a moment.
shall i create an artificial rect class?
Example:
class Arrow(pygame.sprite.Sprite):
#this is the possition of the sprite and size
self.x = 100
self.y= 200
self.height = 90
self.width = 70
self.rect= pygame.Rect(self.x,self.y,self.width,self.height)
def DRAW(self):
a=R_up.draw(screen) #this will use .draw in the R_up== RenderUpdate group with arrow in it using suposedly the self.rect to track position
pygame.display.update(a)
#to move the arrow i just have to update the self.x and self.y values and call self.rect again to update its values
would this work? or theres a better option?
I thinking loud here, im gonna try it now.