Problem with Pathfinding and differently sized layouts

Get help using Construct 2

Post » Thu Jan 15, 2015 8:43 pm

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.
You do not have the required permissions to view the files attached to this post.
B
4
Posts: 4
Reputation: 210

Post » Thu Jan 15, 2015 9:14 pm

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.
B
38
S
12
G
11
Posts: 331
Reputation: 7,712

Post » Thu Jan 15, 2015 10:03 pm

FragFather wrote: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
B
4
Posts: 4
Reputation: 210

Post » Thu Jan 15, 2015 10:59 pm

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.
B
38
S
12
G
11
Posts: 331
Reputation: 7,712

Post » Sat Jan 17, 2015 11:47 am

Call 'Regenerate obstacle map' on start of layout.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,630

Post » Thu Jan 22, 2015 4:19 pm

ramones wrote:Call 'Regenerate obstacle map' on start of layout.


Thanks so much, you saved me!
B
4
Posts: 4
Reputation: 210

Post » Thu Jan 22, 2015 6:54 pm

you could do it like so
You do not have the required permissions to view the files attached to this post.
B
245
S
39
G
15
Posts: 1,941
Reputation: 40,246

Post » Sat Jan 24, 2015 10:56 pm

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?
Image
B
71
S
28
G
12
Posts: 515
Reputation: 12,284


Return to How do I....?

Who is online

Users browsing this forum: marcinkowski, wizdigitech and 17 guests