How do I make multiple enemies shoot at once?

  • Hey guys,

    right now I'm working on the enemy AI for my arcade top-down shooter. I have an enemy object with different behaviour states (handled by an instance variable: ivar_stance = 0,1,2,3). ivar_stance = 0 let the enemy chase you, ivar_stance = 1 let's him shoot you and so on. It's working fine until I spawn multiple enemies. Then every time the enemy is in shooting range (ivar_stance = 2 is active), only one of the spawned enemies is actually shooting at you. The funny thing is, all other events are working fine, just the bullet spawning for the enemy bullet doesn't seem to function.

    Here is the event for the bullet spawning:

    i.imgur.com/3f0Zwox.png

    And here is the event that handles the behaviour states:

    i.imgur.com/WzBnnq8.png

    Can you help me out on this one? I'm searching a solution for a couple of days now =/

  • Probably an easy fix but those linked images are too small to see.

  • Yeah those are thumbnails.

    Pixelpato if you are using imgur, hover over the image and choose "Get share links", choose BBCode and remove the tags.

    Paste the resulting link into your post.

    Btw, you probably only need to add a For each "enemy" condition to your bullet spawning conditions/events.

  • randomly

    Thank you, I just uploaded the pics to imgur. I already implemented a "For each"-loop but this doesn't seem to function. All the actions in this loop function well for each enemy except the spawning of the bullets.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • Add a "For each spr_enemy" where the mark is.

  • Just wanted to let you know, that I fixed the bug. It was the "Every 0.2 seconds" command that prevented the enemy bullets from spawning on multiple enemy objects.

    Lesson learned: if you make a "Every X Seconds" command inside an "For each" loop it will not function for each object instance of this loop.

    Thanks for your help nevertheless!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)