Pathfinding AI problem...

0 favourites
  • 4 posts
From the Asset Store
For problem solving, puzzles, bubbles, platforms and other adventures.
  • I know I'm probably making some fatal flaw here, but I can't get my enemy sprite to follow my player around. When I first set up all of the specifications it was actually working, now I'm not sure what I've done, but what happens now is the enemy sprite has LOS on me and will only move to my original spawn location on the layout, not me or where I move to, and stop moving all together.

    This is what the event sheet looks like:

    System - On Start of Layout

    EnemySprite has LineofSight to Player / Find path to (Player.X, Player.Y) (tried adding Clear PathFinding Obstacles, see if it made any difference)

    EnemySprite - On PathFinding path found - Move along path

    The sprite's LoS properties are: 360 cone of view / range: 400

  • Alright, the problem here is the following:

    • The action Find path only triggers once when you put it under On Start of Layout
    • This means that the path is being calculated only once, being on start of layout

    To fix this, you need to call Find path regularly.

    Don't call it every tick, that would be too CPU consuming. Call it every 1 or 2 seconds, that should work.

  • nihlathak this tutorial might help you

    https://www.scirra.com/tutorials/1118/path-finding

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I usually Google things I need information on and it wasn't yielding much for certain things so I was creating topics. I think I'll search in tutorials in the future. I had a small issue with this Pathfinding, but it's fixed now. Thank you, I appreciate both of your responses.

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