[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] Firing bullets



In this case, we're keeping a list of bullets to avoid
creating/destroying lots of bullets.  Less overhead.  Also, having the
garbage collection kick in during some action would be obnoxious.

The bullet could have a class variable timeToLive that is decremented
during its update().  When timeToLive == 0, then remove the bullet
from the live queue and put it into the waiting queue.