[SOLVED]How do I make pathfinding for multiple enemies?

0 favourites
  • 7 posts
From the Asset Store
Finding the shortest path through the cells based on the A-star algorithm
  • Hello, great people of the internet..

    I have a very strange problem, and considering that my resources are limited in Construct 2, since i am using the free version, not very surprising. (Sorry, but i'm too "cheap" to buy the full version )

    I am currently making a game for a school project, using the FREE version of the software.

    And here i am using the awsome pathfinding feature, when all seemed to work fine for ONE of the SPRITES/Monster of the game, I attempted to make a copy of the same monster hoping they would MOVE IN DIFFERENT PATHS TO THE PLAYER. But it didn't turn out the way i hoped, and thus, i desperatly attempted to make a second Monster Sprite, with the same PathFinding events and actions as the previous one. But this one turns out to be the same, except when the second one works the first doesn't and moves in a parallel path to the other Monster Sprite.

    And for random reasons, sometimes the monsters are ghosting around all over the map(through walls and so on).

    I know that Using the families feature is more appropriate, but please consider that i am using the Free Version.

    Please help me with the problems, using the resources provided in the free version of CONSTRUCT2!

    So far, these are the major problem of the game right now. There are few others, but i think i can figure out the others.

    Please HELP ME...

    The following is the project for the Game;

    [attachment=0:7az1o77h][/attachment:7az1o77h]

  • Try this logic:

    Condition: EveryTick

    ForEach (monster)

    PathFinding>status not equal (is moving)

    PathFinding>status not equal (is calculating path)

    Action: Monster>PathFinding>FindPath(Player.X, Player.Y)

    Condition: Monster>OnFoundWay

    Action: Monster>PathFinding>MoveAlongPath

  • Thank you for the reply, but that did not work for me. (for some reason i cant find pathfinding as a condition...)

    Although that does give me a idea, i tried out my idea.

    I made 2 copies of the same monster, the skeleton?, so now there are two skeleton monster. Running around, each with a MonsterAnimation Sprite, but the thing now is that the monsters do move around on their own accord, JUST THE MONSTER SPRITE not the MonsterAnimation sprite.

    The MonsterAnimation sprites are now moving in a parallel fashion, rather than to their respective Monster Sprite.

    ANY FIX TO THIS?

    To make the MonsterAnimation sprites to follow their own Monster Sprite?

    Also it seems that the second copy doesn't chase after the Player?

    This is the updated copy with my idea applied....

    [attachment=0:6eayaarw][/attachment:6eayaarw]

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • reizmoz

    Is this what you where trying to do? Press "9" to create another monster.

    I'm no expert but I don't think that those for loops are working the way you want them to.

    I always use the on created for new elements I put in the game.

  • donelwero

    Thank you for the reply, i'm kinda new to this software, so i don't know most of what's going on.

    I see that you have taken out my For Each conditions, seeing that it has made no difference in the game itself.

    Is it possible for you (or anyone else) to help me with the problem that:

    1) The second monster somehow isn't really "chasing" the player when it sees it, like the first one.

    2) The sprites aren't attached to their Monster sprite.

  • reizmoz

    Sorry, I've been kinda busy and didn't see your message until now. As I said, I'm no expert but, hope this is more like what you were trying to achieve.

  • donelwero

    Thank you for the help with this.

    Yes, that is mostly what i wanted.

    I guess this is a case closed.

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