pathfinding variation

0 favourites
  • 1 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • 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 ?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)