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

前端 未结 3 846
花落未央
花落未央 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:18

    You need to redraw the whole list after your blit(it covers the whole screen with the surface 'background' and 'erases' it), its not conditional, you need to iterate over the whole list and draw it. Them in the event part you decides who enters and who leaves the list.

    Loop:
      Blit,starting new
    
      Event, here you decide who moves, who begin or cease to exist(append/remove)
    
      Redraw whole list, everyone in the circle_list.
    

提交回复
热议问题