Patrol, Attack, Patrol...

  • Lots of people having problem with this. I got some time so i was trying to solve it, but without much success.

    Any of you guys already solved it? is there a .cap?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • did you check the FAQ section , there's MANY examples on how to solve this ...

  • In fact, I've checked and got amazed how it was not solved.

  • Here ya go , found 2 shiny examples in the FAQ

    An Example

    Another Example

    Also , Your description is too vague , you say if it was a top-down , a platformer , what would be the enemy's behavior , when will the enemy attacks ... etc.

    Next time , if you want some help , please check the FAQ and search the forums ...

    Don't take it badly , cheers !

  • Whiteclaws

    I think you may have missed the point, he's looking to have enemies that patrol, chase the player if in view, but return to their original, pre-determined path if you escape or die. None of the examples in the FAQ cover this as far as I can see.

    Edit: I'll probably have a go at this when I have time, need an excuse to test out the LOS behaviour anyway.

  • Oh , misurstanding , sorry for that , but your description doesn't help too

  • Alright, took some time to get it right, but I think it's pretty stable now. Feel free to tag me (@Nimtrix) if you encounter any issues.

    Anyway, here it is:

    Patrolling.capx (r134)

  • Nimtrix, you have not just nailed the case, but renovated my belief on the human spirit. Is there something i can do for u?

  • Don't worry about it, use it for something cool. <img src="smileys/smiley2.gif" border="0" align="middle" />

    PS: I've noticed they sometimes (although very rarely) get stuck at the corners. You can experiment with the pathfinding cell size/border settings or maybe adjust collision polygons if this becomes an issue.

  • Kyatric this deserve to be on that list

  • Nimtrix really great help mate :D

  • Nimtrix I am trying to do the same using custom movement, but it appears that path behavior have something to individualize the reactions of each instance of the sprite that custom movement has not.

    When doing everything the same way, but with custom, all enemies would run toward the same "Friend" whatever distance they are. Also, the first instance of "Enemy" to catch sight of a "Friend" appears to lead the others.

  • Yea I can't figure out how to do multiple enemy states (6 total). Would it be best to do functions for each state? If that's the case, then you can't do triggers with functions right? And my enemy won't even start his pathfinding, so that's just a whole other problem

  • scirra.com/tutorials/474/pathfinding-with-line-of-sight

    maybe this can be helpful.

    there is LOS working, without the new behavior, and a timer: to go back to patrol when you escape.

    this is working pretty well.

    read the comments , i explain how i managed to implement the equivalent of the field of view on this system, so you can approach by behind.

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