How do I add pathfinding collision with clones of an object?

0 favourites
  • 15 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • I am having a problem while trying to spawn new objects which have pathfinding and solid behavior.

    They seem to not recognize one another as obstacles.

    Can someone help me out?

    Here is what happens, the objects overlap one another.

  • 1 solution is to give them physics, it just makes them bounce off one another, then continue on their path (lol, game can become like a sonic game where they bounce out of bounds)

    the 2nd option, is look at the sample games in your construct 2 (when loading a new project, scroll down) there is a tank family behaviour example.

    it has some code for slowing down the sprite as it gets close to another path seeking object

  • Is this the logic that you was looking for ? ... DQ3MXNMUFE

    There are 3 major things you have to deal with.

    1/ there is only one obstaclemap for all

    2/ find a path & calculate obstacle maps take time

    3/ the calculated obstacle map is available in the NEX tick

  • I saw your capx and some of the players still overlap one another.

    I also saw the events and am really surprised why this simple functionality should be this complicated.

    Didn't the Scirra team add it for the sake of making it all better?

    Forcing the object itself not to overlap with other spawned objects and all of them should not overlap solids.

  • First of all we talk about html5. En that is still not the most performant and brilliant engine on the world. But, it works in all browsers. If you choose for Construct you choose for html5. I suppose that did not yet dawn to you.

    Constuct is no more then a UI to write html5 code. Scirra did not make html5. But they do their best to adress all the inperfections of html5. One of those is performance. This is why you find choices all over Construct. A choice to do it 'that way' to keep it performant.

    Only one obstacle map is one of those choices. So if you have 100 solids (if you choose for solids) running arround, rebuilding the obstacle map for one rebuilds the obstacle map for all. Hence, if the one thats supposed to find a path is an obstacle too, it will not find a path. If you had read the manual, you would have known this.

    Next. The pathfinding behavior finds paths. Thats all. It avoids obstacles based on the gridsize and the cellsize you gave it. It does not know how big your sprite is. It is just what it is meant to be, an easy help for finding paths.

    Not happy with it? No problem. Build your own pathfinding. You can find exellent examples on this forum. Yet none of them will account for the size of the pathfinding sprites.

    If you think that pathfinding combined with physcis and ray tracing should be a basic option in a html5 engine, then let me ask you: why is that plugin not made yet ? There are plugins for almost everything.

    I gave 1 example. And it is a complete AI. The logic that answers your question is in there in 1 event. I cant show the funtion of a steer when i cant build wheels under it.

    I am sorry it did not meet your lazy expectation.

    But i did not earn that sneer. No one did.

  • Never mind I found a fix for this and was really easy, it is already implemented into construct 2 but it is more of a trick.

  • Hi,

    Can you post your easy fix, I have been trying to figure this one out for weeks now without any success.


  • Make the objects as platformers and set all values to zero.

    Then make them bullets also.

    Add pathfinding and it is done.

    Platformers will not allow them to intersect.

    There are other issues with this method though, for example when player is overlapped, it teleports him.

  • Thank you very much I will try this out! Really appreciated!

  • hi

    i try for it, but objects overlapping !

    can you share capx?

  • hi

    i try for it, but objects overlapping !

    can you share capx?

    Hi, let me know if you solved it.

    Otherwise I will try to find it.

  • Try Construct 3

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

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

    thank you for reply,.

    No , i still have the problem with that, if you can find the capx and share it.

    best regards.

  • Hi,

    thank you for reply,.

    No , i still have the problem with that, if you can find the capx and share it.

    best regards.

    I just saw that the whole game I was working on was deleted when I transitioned on Windows 10.

    I feel quite bad now that I noticed it. <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    Anyway, I will try to recreate that game again and I will send it to you when it is done.

    Though it is really easy to do. Just add all objects the platformer and make all platformer attributes zero.

    Then add bullet. That's it, it should work.

    But good news, I found the tutorial where I first found it! <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

    Subscribe to Construct videos now
  • Wow, Thank you. I will try that .

    also, i'm wating for game!

    best regards.

  • Wow, Thank you. I will try that .

    also, i'm wating for game!

    best regards.

    Thanks! Good luck!

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