Platformer enemy move past another while preventing stack ?

0 favourites
  • 2 posts
From the Asset Store
10 Retro songs ideal for platformers or farming games
  • I have a push out code to prevent enemies from stacking but if one enemy wants to move in front of another enemy then they will push that enemy while moving. I am looking for a way to prevent the enemies from stacking but also have a way for an enemy to move in front of another enemy. This is for a platformer.

    Any help appreciated and I have searched for an answer and couldn't find one for this problem because they talked about preventing the enemies from stacking and not if there was an enemy moving past another enemy.

    Example picture. If E1 stops or is moving slower and E2 is moving then E2 will push E1 towards location while moving trying to get ahead. Without a way to prevent them to stack then they will move and stop on top of each other.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There are a lot of possibilities here depending on the kind of behavior you want these enemies to have. For instance, if and enemy is within X distance of player and is overlapping another enemy at X offset, the enemy could switch to an attack state at that point, rather than continuing to move to it's pre-set destination. It could also just wait in a queue to attack if the enemy doesn't have ranged attacks (which would mean going to your initial action setting it's state and adding logic to account for whether it is overlapping an attacking enemy and within X distance of the player).

    Do these ideas help?

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