Making other enemies back off when one is near player

  • Could someone direct me to a tutorial or a forum post that might explain how to make all other enemies in a level stop moving towards the player and wait once one is near the player? I assume it has to do with the system selecting the closest instance of an enemy and then turning off any chase-type behavior on all the others, but it would help if I could see an example to learn from.

    Thanks in advance!

  • If you're unable to use families, then, you should pick the ID or UID of the enemy with the desired distance and check it against other enemies, every enemy with the ID different of that pick should back off.

    But I prefer to simplify it using a mask around the player, when it touch an enemy, trigger a condition to set your needs.

  • Thanks for replying. I will probably purchase Construct once I've made sure that everything I want to be able to do in my game is possible, so I'll be able to use Families then.

    In my game, an enemy does collide with a hidden player object when in range, so I guess I just need to trigger a condition that all other enemies of the same type (or in the same Family) will move at least a certain number of pixels away? Again, an example would help a lot, but I understand what you're saying. Much appreciated.

  • Is this any good? Looks like the technique that TELLES0808 described.

  • That's interesting, will definitely try to implement it a little later when I have more time. Thank you sharing!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • creating a family will help

  • caplocks1111 How? That's really not helpful, at least take the time to elaborate your answer.

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