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

0 favourites
  • 4 posts
From the Asset Store
Welcome! I-Spy (Hidden objects) is an educational puzzle that is more than just seek-and-find activities.
  • 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.

  • 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.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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.

  • 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..

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