[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
Re: [pygame] OSX sprite flickering
> I couldn't find a good way to efficiently combine the reclists and have it
> update them at the same time as i cant guarantee they will both exists that
> iteration so you cant do List + None.
   #Update the moving sprites.
   if not tick % npc.UPDATERATE:
       people.update()
       bullets.update()
       people.clear(screen, clear_cb)
       bullets.clear(screen, clear_cb)
       people_recs = people.draw(screen) or []
       bullet_recs = bullets.draw(screen) or []
       pygame.display.update(people_recs + bullet_recs)
If the return from draw is a non-empty list, that will be used.  If
it's empty or None, the fallback list (or []) will be used.
Might need to toy with the ordering a bit.  I think clear-before-draw
is correct, but I haven't played with it myself.
-FM