Can't use Path finding through moving Gate.

0 favourites
  • 9 posts
From the Asset Store
Run, jump over or on enemies and reach the path’s end as fast as you can!
  • Creating a Top Down game using mouse click path finding to move.

    I built a Wall of Solid objects.

    Created a spot were I placed a Gate (Solid Object).

    When you click the gate it opens (Move 5 pixels at angle 90. Wait 3 seconds. Move 5 pixels Again ect... until its out of the way)

    So the gate gets to the point where it is completely out of my way.

    However i can't move through the opening (its big enough).

    Not sure what is going on here. Is the collision region not moving with the object and staying behind?

  • "Not sure what is going on here. Is the collision region not moving with the object and staying behind?"

    Yep this is what is happening. I tested this out by placing the gate in the middle of my map. Moving the gate then watching the path the player takes around the gate.

    So how do i Fix this issue?

  • Ok so calling Regenerate Obstacle map fixes this issue.

    I'm going to have to call "Regenerate Obstacle Map" after every move X pixels is called.

    Is there a better way?

    Thanks.

  • I'm going to have to call "Regenerate Obstacle Map" after every move X pixels is called.

    Is there a better way?

    Calling "Regenerate Obstacle Map" after every move X pixels is called is making the game very choppy. Going to have to find another way to move the gate.

    Any Suggestions?

  • You only have to call Regenerate if the door has moved enough to make a difference to the underlying cells involved. So when opening, you only need to check when it has moved a cell width. When closing you call as soon as it overlaps another cell width.

  • There's also the 'regenerate region' action so you don't have to regenerate the whole map.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ya what I recently discovered is you can make a invisible sprite and attach it to your character. Then tell your pathfinder to regenerate the region around that invisible sprite.

  • Ya what I recently discovered is you can make a invisible sprite and attach it to your character. Then tell your pathfinder to regenerate the region around that invisible sprite.

    Is there a tutorial or anything else with more information on doing this?

  • Ya all you need to do is:

    Double Click on your layout and create a Sprite. Name it whatever you like and make it any color. Choose Invisible in the Properties Menu (Default left side panel) -> Initial Visibility -> Invisible

    In your Event:

    Every Tick | "Your newly created, invisible sprite" | Set position to another object --> "Your Character Sprite"

    Every Tick | "Your Character Sprite" ( Or whatever has the pathfinding behavior attached to it) | Regenerate Pathfinding Obstacle Map around --> "Your newly created, invisible sprite"

    Thats it!

    Hopefully that helps.

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