Im new to python and im trying something with pygame but dont know how should I do this..
def addRect(x, y, width, height, color, surface):
rect = pygame.Rect(x, y, width, height)
pygame.draw.rect(surface, color, rect)
pygame.display.flip()
Thats for creating rectangles but my question is how should I access the ractangles I create ? Im trying something like .
r1 = addRect(20, 40, 200, 200, (61, 61, 61), screen)
But then when I try to move it using
r1.move(10,10)
I get an error
r1.move(10,10) AttributeError: 'NoneType' object has no attribute 'move'
How should I access it ? thanks-
rectfrom the function.