pygame.Rect question
Peter Pearson
ppearson at nowhere.invalid
Mon Apr 9 11:41:17 EDT 2012
More information about the Python-list mailing list
Mon Apr 9 11:41:17 EDT 2012
- Previous message (by thread): pygame.Rect question
- Next message (by thread): How to resolve circular reference in python C extension?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Sun, 8 Apr 2012 16:58:01 -0700 (PDT), Scott Siegler wrote: [snip] > 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. I'm not a pygame expert, but . . . it would be consistent with Python's conventions for ranges of indices if rect.right() were the first pixel *outside* the rectangle. Of course, one would expect rect.bottom() to work similarly. If this is the right explanation, it will be useful to picture indices pointing between pixels, rather than at pixels. -- To email me, substitute nowhere->spamcop, invalid->net.
- Previous message (by thread): pygame.Rect question
- Next message (by thread): How to resolve circular reference in python C extension?
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list