colliderect()
function won't return True
and False
; instead, it is returning 0
and 1
. When I use the function type it says int
instead of bool
. If I code using 0
and 1
instead of the boolean value the code works, but why is it happening? Pygame documentation doesn't mention anything about it.
def collisions():
tileHitsList = []
for rect in tileList:
print(testcube.colliderect(rect)) #it weirdly prints 0 and 1 instead of False and True
#tileList is a list which contains the rects of the tiles being rendering on the display
#testcube is a rect that hits the tiles
if testcube.colliderect(rect) == True:
tileHitsList.append(rect)
return tileHitsList