I'm about to lose my mind!

Not favoritedFavorited Favorited 0 favourites
  • 15 posts
From the Asset Store
A set of board games to make your day joyful. Play, Enjoy, Relax
  • Sprites with pathfinding behavior get stuck when they collide with layers.

    I have tried all the suggested solutions:

    Cell Size: 16

    Cell Border: 50

    Obstacles: Solids

    I made a video:

    uploadnow.io/f/r7jR60w

    Tagged:

  • I thought this forum was active

  • Border 50 seems too much for cell size 16. Read about cell and border size:

    construct.net/en/make-games/manuals/construct-3/behavior-reference/pathfinding

  • I thought this forum was active

    This forum is actively read, but not all questions have the right information to give an answer.

    For example, in your question, besides the settings of the path search itself, it would be good to check all collision masks and objects that are on the path, but you can't do it just from a piece of video. The best way is to attach the source with a piece of problematic code, graphics and all unnecessary things can be removed.

  • There is a sprite with pathfinding behavior that is visible in the video and there is a house sprite (with solid behavior). The other things that are visible are on different layers.

    When I tried like this, it was jamming:

    Cell Border: -1

    Then I read on the forum that as you increase the number, the sprite stays further away from the solids. So I increased the number but nothing changed.

  • I tried with the following values:

    ________

    Cell Size: 16

    Cell Border: 80

    It worked but it was too far from home.

    ________

    Cell Size: 32

    Cell Border: 20

    It worked but it was still too far from home.

    ________

    Cell Size: 16

    Cell Border: 10

    It didn't work, it got stuck.

    ________

  • There is a sprite with pathfinding behavior that is visible in the video and there is a house sprite (with solid behavior). The other things that are visible are on different layers.

    I look at your video and the collision grid of the house and I see that the character is as close to the house as possible (screenshot), he can not get closer he is prevented by the sprite of the house.

    But your house has a strange sprite, I would do a mask coliziya just on the object without grass around.(orange on the screen).

    And more when the character runs behind the house you can show his animation solid fill (red on the screen) that the player saw what the character does.

  • Are you sure that the origin point and collision polygon are the same in all animations and frames? When you have so many animations, it's better to use a separate invisible sprite for the character - with pathfinding behavior. And attach the animated sprite to it.

    Do you know why the character gets stuck? Does "On failed to find path" get triggered? Pathfinding only works within the layout bounds, so make sure the layout size is correct.

    Anyway, it's a guessing game without the project file.

  • To give details;

    All collision polygons in all animations are exactly the same.

    To understand what is happening there, I added flash behavior to the sprite and;

    -Event:

    * Sprite on pathfinding failed to find path

    * Is overlopping House

    - Action:

    * Start Flash.

    I ran it in debug mode. When the sprite is squeezed by the house, it cannot find the path, and flash is activated. However, when I destroy the house, flash does not work and the character does not move anymore.

  • Let me make a correction. When I destroy the house in Debug mode, the polygons remain there. That's probably why destroying it doesn't work.

    If the sprite gets stuck and I change its position and move it away from the house, it continues to find its way again.

    By the way, I like the idea of ​​creating masks while I'm behind the house. I'll learn about it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • When you remove or add obstacles to the map, you must perform a “Regenerate” action for the entire map or individual sections.

    There are many good examples of this behavior in C3 and it is well described in the help.

  • I removed the Solid behavior for the house.

    I added a different solid sprite and placed it invisibly on the map.

    I created the following event and action in case the calculations were wrong:

    On start of layout / regerenate pathfinding obstacle map

    I rechecked all the collision points in all the sprite's animations (all the same).

    I moved the sprite's focal point to the center for all the animations.

    I rechecked all the events and actions.

    Still the problem persists.

    So I added:

    Sprite / On Pathfinding failed to find path / sprite move forward 30 pixels.

    Of course it's ridiculous but at least it pops out when it gets stuck.

    It works but it doesn't look right.

    I'm not happy about this at all.

  • It looks like a crutch. Could you upload an example file with this piece of code so we can fix it for you?

  • Hello everyone

    To solve the problem, I prepared a very simple event sheet with very simple sprites. All events are as they appear on the screen. The sprite named Wall has a solid property. When I clicked in front of and behind the wall frequently (when I triggered pathfinding very often in a row), both the sprite I was directing got stuck on solid and the enemy sprites following me got stuck.

    I think the problem is not related to me now.

  • Now I've made it as simple as possible. Again, a lot of enemy sprites are stuck like a mouse touching sticky.

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