How do I randomise AI wander?

0 favourites
  • 3 posts
From the Asset Store
Pathfinding AI
$0.50 USD
95% off
Units do not overlap each other and use different ways if there are several free ways.
  • So I'm working on a top-down game where enemies randomly spawn so far out of the players view, but until the player gets so close the enemy AI will kind of wander around at random intervals. Like it will just be stood still for a second or two, then randomly turn around and walk in a random direction for a few seconds then stop and do the same in another random direction until the player comes into it's aggro range.

    Any suggestions would be incredibly helpful!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Maybe using bullet would do the trick?

    compare two values - distance(player.x,player.y,enemy.x,enemy.y)

    if not agro-----------------greater than X

    -------------then

    -------------set enemy "agro" true

    isn't agro

    -----every X seconds

    -----set bullet speed to X

    -----set bullet angle to random (360)

    is agro

    -----move towards angle -

    -----angle (self.x, self.y, player.x, player.y)

    -----X pixels

  • Thanks, CloveltOc. I tried a few things, played around and managed to figure out how to use Line of Sight and Pathfinding to randomise movements when not aggro'd and then attack the player when aggro'd anyhow.

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