[Solved] How can you make several objects fire at the same time or at different times?

I’m redoing the PVZ game, but I’m having trouble with the plants shooting one at a time, when they should all be able to shoot!

Hi, without your events no one can really tell for sure what the problem is.

I’m trying to make a system that, in short, plants shoot enemies. But I’ve only managed to get the plants to shoot one per line. In other words, I can put 5 plants in a row and they shoot normally in sequence. But the plants in other rows wait their turn, which is strange

To ensure that all instances of your objects are shooting, you could use a ‘for each’-event. Something like:

but I am not sure whether this is what you actually want.

Besides that I have some trouble to understand your events. Your subevent for variable of Plants = 8 creates bullets but this is also true for the main event at the beginning, why is that? I am also not sure why you have the wait-action, is it for the fire-rate? If so, I would rather use a timer. The wait-action can create problems and may not work as you expect.

It’s still not working.

Let me explain: Each plant has its own number in the type variable: That is, type 8 is one plant and 3 is another with different things between them, you know? The fact that type 8 creates the object again is just because it has to, because it releases 2 projectiles at a time, you know?

I used to loop the actions, but I did it based on this variable called action, so that when the plant shoots, it only shoots once and then returns to the previous condition of the variable that allows it to shoot again.

Also, I didn’t understand what problems the wait-action would cause

Okay, I understand a bit better but not completely. It seems the problem is the position-conditions. They work but only for one enemy. One solution could be to put them also in a loop to make sure that the instruction applies to all instances, something like:

I added the wait-actions to see if they cause a problem but that’s not the case. I still would rather use timers for the fire rate, but if it works for you there is no need to change anything.

1 Like

I love you! Thank you very much, it worked perfectly when I put the condition on each enemy

1 Like