How do I randomise AI wander?

Get help using Construct 2

Post » Fri Aug 12, 2016 9:32 pm

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! :)
----------

If you need a hand with anything, just drop me a PM.
B
8
S
2
Posts: 29
Reputation: 560

Post » Fri Aug 12, 2016 9:50 pm

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
B
9
S
3
Posts: 150
Reputation: 1,264

Post » Sat Aug 13, 2016 12:11 am

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.
----------

If you need a hand with anything, just drop me a PM.
B
8
S
2
Posts: 29
Reputation: 560


Return to How do I....?

Who is online

Users browsing this forum: ivanski1983, KTML5, XavierOrionGames and 5 guests