Help switching between pathfinding behaviors

0 favourites
  • 4 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • I'm making a top-down game where an enemy (the "Creep" object) chases the player using pathfinding when the player sprite is seen by "eye" objects. (Note: the enemy pathfinding behavior is set to use solids as obstacles, which in my case is a tilemap.) So far I've succeeded in getting the enemy to go to the last seen location of the player sprite and then retreat back to a location below.

    Since that's not very difficult (or more importantly, suspenseful) I've also attempted to implement a searching behavior: upon reaching the last seen location of the player sprite, the enemy should "look around" by pathfinding and moving to random X/Y coords near the player. But the enemy is being uncooperative. It refuses to search and instead simply retreats once it has traveled to the last seen location.

    I've tried reprogramming my events in half a dozen ways, most of which caused other significant bugs with the enemy behavior. Screenshot of my current configuration is attached. Any help would be much appreciated!

  • There is no trigger for event 18, so your object instantly progresses from the search state to the return state in the same tick.

    Also there is no point in adding a repeat 10 times in event 14, that will cause your object to find a path 10 times in one tick and keep overwriting itself.

    Remember the entire event sheet runs once per tick. If you're doing anything over time, use states, tweens, and/or timer behaviours with triggers upon finishing.

  • oosyrag thank you! I'm still very new to this, I'm learning as I go along.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I got it working! Thanks again oosyrag :)

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