Misguided Enemy Patrols via Pathfinding

0 favourites
  • 1 posts
From the Asset Store
Forget about default textbox restrictions, you can create sprites atop of the textbox
  • CAPX: https://www.sugarsync.com/pf/D6025908_4317202_6984579

    Please forgive me for the HUGE problem-laden post here. I don't expect anyone to be able to help me with EVERYTHING, but any input could prove useful. Thanks.

    Here's the rundown on the Enemy behavior:

    1. Patrol - The Enemy instances will travel between the PatrolNode object; the directions are determined by the frame number of the object.

    2. Chase - When the Player comes into view of the Enemy line of sight, the Enemy will chase the Player until line of sigh is lost.

    3. Alert - The Enemy will patrol from within a radius from the last known spot the Player was seen. After so much time has elapsed, the Enemy will return to its original patrol route.

    4. Resume - After the Alert phase is over, the Enemy will seek out the PatrolZone it was assigned to at the start of the level, preventing Enemies from congregating in one zone.

    The problem I'm having is multi-fold.

    1. I can't get the Enemy to begin its patrols normally. I've created an image point to act as a "horse following a carrot held on a string". While in Patrol mode, the Enemy will plot a path to its own image point every so many seconds. But at the start of the layout, all Enemy instances start moving forward only to veer off and keep going until they hit a wall...

    2. I'm told by that some of my Event lines need some For Each conditions (he didn't have time to help me see which ones, though). Arima informed me to treat Families (which my Enemy objects exist in) as objects in their own right with each object in the family as an instance. Makes sense. But I'm still lost as to what I need to change.

    3. I need my patrol system to be adaptable to whatever level I place the PatrolNodes in. I've been trying several different set-ups so that the Nodes can identify with other Nodes that are possible route destinations. (For example, I had each Node fire off an object that, when it collided with another Node, it would store the target Node's IID into an Array. That Array would later be used to reference WHICH Nodes were acceptable destinations via Pathfinding.) Presently, I've simplified the possible routes FROM each Node (no more than two; previously there were up to four directions possible). What I'm doing now is trying to set it up so that the possible routes (variables Direction1 and Direction2) are turned on or off (based on boolean WhichDirection. So if a Node has north and south as route options, if the Enemy is moving south, then the south option will be "on", allowing the Enemy to continue south and not be forced back north. But on a return trip, the north option will be turned on and the south turned off (since the last pass), allowing the Enemy to continue north. So each pass toggles the direction the Enemy can take.

    I think that "sums" it up nicely. Thank you, again, for your input and suggestions. I'll be glad for any help to get this worked out.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)