Multiple Enemies toward Player with Pathfinding

  • Hi everyone,

    *** Before, let me thank everyone on the forum who post questions, answers and help others. Sincerely, Thank you, I would have never achieved what I succeeded doing until now and I hope to get your knowledge in the near future to help others as well.***

    • The capx allows you to see how the Player moves toward Mouse clic with Pathfinding
    • How an enemy detects the Player and chases him with Pathfinding
    • On Attack Range, how the enemy triggers his attack animation
    • If the Player manages to escape, the enemy returns to its position

    Here is my problem. I would like to create multiple enemies (same sprite and behavior) who have their own position on the map. When the Player gets into their range, only the enemy who detects the Player needs to chase him. If the Player manages to run outside of the detection range, the enemy returns to his initial position. So, it works for one but not for multiple enemies.

    How can I post the capx from dropbox?

    if I paste the link, it does not work, because of security spam

      1. null

      <img src="smileys/smiley1.gif" border="0" align="middle" /> <img src="smileys/smiley1.gif" border="0" align="middle" /> <img src="smileys/smiley1.gif" border="0" align="middle" /> <img src="smileys/smiley1.gif" border="0" align="middle" /> <img src="smileys/smiley1.gif" border="0" align="middle" />

    • Maybe you should re-post this in the 'How do I .... "

      section of the forum.

    • Thank you producermark11

      <img src="smileys/smiley1.gif" border="0" align="middle" />

    • Try Construct 3

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

      Try Now Construct 3 users don't see these ads
    • Underdog I think this is a case of using - or not using - "for each" enemy in the events. When you post the capx I'm quite sure it will easily be solved.

    • Hi Windwalker,

      Thanks for the tip. I also tried it but it seems that I have an issue with the "For Each" event for this behavior. I'm pretty sure that once I will get my Construct 2 licence (soon), "Family" will fix my problem or there is probably something I did not get lol

      I also think to change my Detection behavior with the Turret/Line of sight behavior and checking distance. And, having an array to check if enemies are not overlapping. If they do, move to another closest free "array cell" from the Player. What do you think? Is this a good approach or do we have something easier?

      However, I post the capx in the HowTo Forum. Still can't post the any link on the forum yet but I "cheat" it to post it. Sorry, it's a bit odd.

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