Ha! That makes things much easier to take in. So I was doing it partially
right. Thanks for the insight! You're a lifesaver.
The pygame mailing list is really great... I don't know what I'd do without
you guys!
On 4/1/07, andrew baker <[EMAIL PROTECTED]> wrote:
Well, I start by making a container, which will be just a simple list
bullets = []
This is assuming the simple case, where all of the bullets are the same
type.
Then, create a bunch of bullets
for i in range(0, totalBullets):
bullets.append(myBulletClass())
When you need a bullet,
firedBullet = bullets.pop()
When that bullet "dies",
bullets.append(firedBullet)
You might want to make the bullets list into a whole class if you
start adding features, but for most cases, this is all the firepower
you'll need.
As for patterns, I would do macros, personally.
Declare different functions that do small patterns
def starBurst(qty):
angleSlice = 360/qty
for i in range(0, qty-1):
current = bullets.pop()
current.movingX = math.cos(angleSlice*i)*current.maxSpeed
current.movingY = math.sin(angleSlice*i)*current.maxSpeed
Then, assign and object's fire function to the value of the function
myBadGuy.attack = starBurst
Now, when you call myBadGuy.attack(), your starBurst function will be
called.