Hm, but than, r1.bottomright should be (99, 99) and not (100, 100)!?
Or is topleft inside and bottomright outside the rect?
Julian
Lorenz Quack wrote:
Hi Julian
jug wrote:
import pygame
r1 = pygame.Rect(0, 0, 100, 100)
r2 = pygame.Rect(50, 50, 0, 0)
r1.contains(r2)
1
r3 = pygame.Rect(50, 50, 50, 50)
r1.contains(r3)
1
r4 = pygame.Rect(100, 100, 0, 0)
r1.contains(r4)
0
I would expect a 1 in the last line as well.
I wouldn't.
r1 starts at position (0,0) and has a width and height of 100 each
meaning
is goes from 0,0 to 99, 99 which amounts to 100 pixels in each direction.
r4 lies just outside of that.
Note that the arguments to Rect aren't start and end position but
rather x,y,w,h
yours
//Lorenz