My enemies shots are sinchronized and I don't want that.

0 favourites
  • 7 posts
From the Asset Store
A sound pack containing 132 laser gun sound effects, including mono and stereo versions of audio files.
  • I'm having a little problem when my enemies shoot me. They are shooting at the same time. The enemy that just entered the screen waits until the other one is able to shoot again and shoots together instead of shooting on his own.

    Let me know if I wasn't clear.

    The sinchronized shots I´m trying to avoid:

    The events related to them:

  • Your problem is your last event, as every enemy is under the same "random" condition. You should instead use a Reloading boolean + a Wait(random).

    Look at this example I made :[attachment=0:1zs1208c][/attachment:1zs1208c]

    You can toggle Line of Sight on enemies by clicking on them, as I didn't want to do the full game ^^

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are several ways of dealing with this.

    First is that you can add a distance check, so only enemies that are within a certain range will attack.

    You can do that by adding a for each and use Distance(X1,Y1,X2,Y2) and check the distance between the enemy and the player.

    Another way could be to add a reload variable to your enemies, and whenever that is 0 it can shoot. But no matter what you need to add a For each, as of now you select all Enemies that meets these conditions. And since both enemies have line of sight to the player, and are selected with the "Is LOS = true" that will again trigger both.

    Btw you don't need that variable The EnemyShooter -> Has LineOfSight to player already does that. So you could simply add that one instead of the variable.

  • Thanks guys! I will try what you told me to do and post again later! Thanks!

  • It's working! Thanks for everything!

  • You may want to put the for each as the parent event and the other (on-screen, lineofsite, etc...) as subs to it so that it doesn't do all of those tests each time. May save you some computing cycles...

  • BluePhaze, thanks for the tip.

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