pygame.Rect question

Scott Siegler scott.siegler at gmail.com
Sun Apr 8 19:58:01 EDT 2012


Hello,

I am new to Python and began using pygame to start some game programming.  I was hoping someone could help me out with something that seems simple but is really confusing me.

I am creating a rect and then using the attributes of the rect to set the size and location.

I set rect.left to 30, rect.top to 30 and rect.width = 20

This works fine.  However, when looking at rect.right() it shows that it is equal to 50. I suppose this is equal to 30+20.  However, since the first pixel is on location 30, wouldn't the 20th pixel be on 49 (not 50)? 

Am I missing something here?  It is really confusing me when I am doing some collision algorithms.

Any help?

Thanks,
Scott



More information about the Python-list mailing list