Reputation: 13
Right now my code has 2 random aliens shoot 1 bullet, but I want this to loop so that when the bullets leave the screen, it loops for 2 more random aliens shooting bullets and so on.
the class for the alien bullets is called Alien_Bullets within class Space_invaders there should be the sprite group for the alien bullets and I need to include the looping bullet effect within the function update under Space_invaders
Upvotes: 0
Views: 774
Reputation: 4451
You should keep a reference to the Alien in your Alien_Bullets
, then when de bullet gets destoyed you trigger a new shot. You can keep a counter in your Alien to know how many bullets it shot. When the counter reches 3 or the bullet hits the target you reset the counter and stop shooting.
Upvotes: 1