I am trying to create an infinite loop of a circle moving across the screen using a while statement, and I would like to know how to use a key stroke to activate a break command to stop the loop?
while run_me:
clock.tick(fps_limit)
for event in pygame.event.get():
if event.type == pygame.QUIT:
run_me = False
if event.type == pygame.KEYDOWN:
if event.key == pygame.K_LEFT:
T = 1
while T == 1:
posx = posx - 1
screen.fill(black)
pygame.draw.circle(screen, colorcircle, (posx, posy), 50)
pygame.display.flip()
if posx == 0:
posx = posx + 600