How do I make sure I can only crawl through certain objects?

Get help using Construct 2

Post » Sat May 30, 2015 3:35 pm

Hi there,

This might be a long shot, but let's give it a try. I'm using paths to calculate the movement of my characters, and based on different types of input they can either walk, run or crawl. Now I'm trying to figure out how to stop my characters if I they are not crawling (in this example through a crack in a fence. The red squares represent solids that I only display here to show you that when crawling, one of the solids is removed so an opening is available.

However, if I start to crawl to the other side of the fence, and then change to run right away, it is now possible to run through the same opening. Is there a way I can avoid this? I have now "cheated" by moving the character to the other side of the fence depending on which side of it they are standing, but I can't seem to figure out how to avoid being able to run through the solid after first starting to crawl.

Solid2 is the name of the red solid that you can see disappear.

Image

Image
B
14
S
3
Posts: 123
Reputation: 1,571

Post » Sun May 31, 2015 7:56 am

Hey @oceldot, :)

I haven't worked with the path finding system very much, but one thing that might work is forcing the path to recalculate when you change posture.

This way, if you stand up, the solid will reappear, the path finder will be forced to recalculate a path to the last destination given, and the path will no longer be valid.

If you try this method out, for obvious reasons, it's important to make sure that the path is getting recalculated only after the solid reappears. Behaviors and event sheets can sometimes execute their effects in an order you aren't expecting. IF this becomes an issue, you can place the path recalculation action after a wait( 0 ) action, to delay the recalculation to the end of the frame.
B
27
S
18
G
8
Posts: 327
Reputation: 6,154

Post » Sun May 31, 2015 9:38 am

Hi,

Thanks for your reply. As you can see on my first screenshot, I'm trying to recalculate this part of the level every tick. I tried now to trigger it once every time "Crawl" changes to either true or false as well (after moving the solid). Still no cigar.
B
14
S
3
Posts: 123
Reputation: 1,571

Post » Sun May 31, 2015 9:46 am

Regenerating the obstacle path every tick doesn't sound very usefull

Add a trigger once condition

crawl is false
sytem trigger once
- solid2 set y to 131
- regenerate obstacle map
- find path

crawl is true
-- systen trigger once
> solid2 set Y to -100
> regenerate obstacle map
> find path
-- on path found
> ...etcetera....

after regenerating the obstacle map, you will have to find the path again..
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775


Return to How do I....?

Who is online

Users browsing this forum: blue visionary and 4 guests