Hello,

It seems Rect.collidepoint(x,y) works fine as long as the Rect's top
and left values are set to zero. When the Rect object is offset from
zero, collidepoint returns 1 when (x,y) is outside of the Rect.
Example:

import pygame
r = pygame.Rect(10,10,110,110)
r.collidepoint(0,0) # GOOD
0
r.collidepoint(10,10) # GOOD
1
r.collidepoint(110,110) # BAD
1
r.collidepoint(119,119) # BAD
1
r.collidepoint(120,120) # GOOD
0

Sincerely,
Guillaume Rava.

Reply via email to