I have a function which checks for collision
def collision_check1 (pboard_rect):
if pboard_rect.colliderect(up_border_rect):
pboard_rect = pboard.get_rect(topleft = (695,20)
print("hi")
if game_active:
collision_check1(pboard_rect)
Here it prints 'hi' but it doesn't move my pboard_rect what to do
edit:
pboard_x = 695
pboard_y = 200
pboard = pygame.image.load("data/pboard.png")
pboard_rect = pboard.get_rect(topleft = (pboard_x,pboard_y))
screen.blit(pboard,pboard_rect)
get_rectis incomplete. you assignpboard_rectinside the function, it is a different variable compared to argument used incollision_check1(pboard_rect). Do not do side effects in a function. This functionchecksand should return aTrue/Falsepboard_rect = pboard.get_rect(), Read the Python docs on variable scope