pathfinding variation

Get help using Construct 2

Post » Tue Jul 16, 2013 10:07 pm

hello all, im making a top down shooter and i have some enemys who chase the player with pathfinding.
i have a problem because when they are many, they stack on each others and follow all the same path.

i would like to implement a code which can make them use differents paths

one enemy could go stright forward to the player, one could try to catch him by the right side, and the third by the left side.

i found a way but its not perfect,
each enemy have a vairable named random which is set : random(-150,150) when the enemy detect the player
> when the distance between player and enemy is > 150 , the enemy go at player.position+enemy.random

then when its closer it goes to the player.
but its not working very well, it could be far better, they dont stack on each others but they dont try to contourn the player. is anyone have a better idea ?
B
19
S
5
Posts: 104
Reputation: 1,761

Return to How do I....?

Who is online

Users browsing this forum: duke2704, megatronx, sebrosen and 1 guest