In Python, indentation controls what code is part of what block: all the contiguous code at a particular indentation level is part of a block, and any lesser indentation ends that.
As a result, your
if
statement
if x > screen.get_width()-90 or x <0:
terminates the
while
loop above it meaning that the loop consists only of this code:
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
pygame.time.delay(20)
pygame.draw.rect(screen,[255,255,255],[x,y,90,90],0)
x = x + x_speed
Since
running
does not change inside the loop unless the user exits, and the loop does nothing else at all until that does happen, the screen remains blank.