Finding a path when enemy has line of sight

  • I'm totally new to Construct 2. I'm trying to make a sprite (bad_dude) find a path to another sprite (dude) when bad_dude has line of sight to dude.

    As my event I have:

    "bad_dude" has line of sight to "dude"

    and my action is:

    "bad_dude" find path to (dude.X, dude.Y)

    When I move in front of the bad_dude, he doesn't move towards me. I added a sound event to the line of sight action and the sound plays.

    Why doesn't the bad dude move?

  • Have you got another event:

    bad_dude: on path found -> bad_dude: move along path

    And make sure you're not checking for paths every tick when in line of sight. You could add a "system:every x seconds" condition.

  • Thanks for the reply. I do have the event bad_dude: on path found -> bad_dude: move along path

    I tried making the line of sight check every 0.5 seconds and that didn't work either.

  • Hmm make sure there is actually a path from bad_dude to dude and that neither of them have solid behavior if you're using solids as obstacles.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I'm stuck at work now but the solid behaviour could well be the issue! I'll check later. Thanks!

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