Move to location and search

0 favourites
  • 6 posts
From the Asset Store
Searching
$16 USD
Searching is a game where you are challenged to find all the images with the requested letter in 30 seconds.
  • Any thoughts on the following would be kindly welcomed.

    Working on the AI for a top-down stealth outing. I'm looking at a pattern of behaviour for a resident of a house who - on "hearing" something moves to that location. What I have in mind is an enemy AI - who being in proximity to the player, moves slowly / cautiously to the point in 2D space where the player came within a particular proximity to them - say 100 pixels. Moving cautiously should give the player time to evade. Once the enemy reaches the point where the proximity routine is tripped / noise is heard - they'll wander about, look around, and if the player is not in line of sight - they'll resume their duties.

    Problem is working out how to get to that point in space - so they can wander about / look around as opposed to acquire the player and chase.

    Cheers

  • have you checked out the pathfinding behaviour?

  • keepee - yep, on pathfinding. Thanks. Along those lines - how how might you specify the X and Y coords for the enemy to "find path to" as the point in 2D space where the player tripped the proximity threshold around the enemy.

    Maybe another way of asking the question is - how do you get the enemy to find path to a point where the player was - but no longer is?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • won't it just be 'find path to player.x, player.y' ?

    as long as you only run that action when the player is heard or seen it should work..

    if you want to create a more complex behaviour though, for example after the enemy arrives at the point, for it to search around that area... you'll probably want to store the player.x/y to variables like:

    enemy.lastSeenX

    enemy.lastSeenY

    that could act like a kind of anchor point for a search area

  • Player.x, player.y provides a regularly updated set of coords to the enemy to track the player down. Those coords are where the player is at every point in time. So rather than pointing the enemy at where the player was a point in time that has past, it points them at where the player is presently.

    Thinking out loud here - but maybe I need to continuously track player x and y coords all the time. And have the enemy move to that most recent set of stored coords (in an instance variable?) which are made available to it only when the proximity threshold has been reached.

    But how....? How to make the enemy move to a specific point (X,Y) once and only once the player has come within so many pixels....

    I can't quite crack it, but I reckon it'll be so obivious a solution once it's sorted

  • that's what i meant by this:

    as long as you only run that action when the player is heard or seen it should work..

    as long as the action to find the path to player.x/player.y is only run when the player is heard or seen.. aka not every tick

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