Problem with Pathfinding and differently sized layouts

0 favourites
  • 8 posts
From the Asset Store
Units do not overlap each other and use different ways if there are several free ways.
  • Hello, I have the following problem: I start with a character which moves with the Pathfinding Behavior, on a layout of width X. Then, I transition to another layout of width 2X. In this layout, I cannot move out of the "original" borders of the first layout. Does anyone know why this happens, and how can I fix this?

    Since I'm not good at explaining (and English isn't my first language), I simulated the problem on a small .capx so you can see for yourself. Thanks in advance!

    Edit: I forgot to delete line 3 of the event sheet. I put it to see if the problem was that pathfinder couldn't find a path. You can delete if you want.

  • I took a look at your file. Is there a reason your backgrounds have collisions enabled? This appears to be what is stopping the character. An object with collisions enabled is considered an obstacle when path finding. I set collisions to disabled on both the number 1 sprite and the number 2 sprite and the character traversed the entire width of the area just fine.

  • I took a look at your file. Is there a reason your backgrounds have collisions enabled? This appears to be what is stopping the character. An object with collisions enabled is considered an obstacle when path finding. I set collisions to disabled on both the number 1 sprite and the number 2 sprite and the character traversed the entire width of the area just fine.

    I guess my example wasn't exactly the same as the real problem >< The thing is, in the real game I'm using TiledBackground elements instead of sprites at the background, and it seems TB's don't have the "collissions enabled" property. Also, I think I forgot to mention, if I visit the bigger layout *before* visiting the smaller one, the problem doesn't seem to appear (which is no good, because I need to visit the earlier stages first). :c

  • Does your character have the "Bound To Layout" behavior? I gave the behavior to the character in the version you posted, turned off collisions and tested it again and got the same results. If I start on layout 2, the player can traverse all of layout 2. If I start on layout 1 and go to layout 2, the character is limited to the area of layout 1.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Call 'Regenerate obstacle map' on start of layout.

  • Call 'Regenerate obstacle map' on start of layout.

    Thanks so much, you saved me!

  • you could do it like so

  • I have the same problem, but i can't seem to get around it, i see you can "Regenerate obstacle map' before you're switching layouts, which seems a little odd for me, since the changes are in the next layout.

    I tried calling it on the start of layout or on the end of previous layout, but no dice.

    Ashely can you shed some light on this problem?

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