Python & Pygame: Updating all elements in a list under a loop during iteration

前端 未结 3 821
花落未央
花落未央 2021-01-07 14:46

i am working on a program in Python and using Pygame. this is what the basic code looks like:

while 1:

   screen.blit(background, (0,0))
   for event in pyg         


        
3条回答
  •  -上瘾入骨i
    2021-01-07 15:33

    To draw all the circles in your list, just iterate through them and draw them before each call to update:

    for circle in circle_list:
        circle.draw_circle()
    

    Edit: the OP had posted incorrectly formatted code, but says the actual code is fine, so removed that suggestion

提交回复
热议问题