Can't use Path finding through moving Gate.

Just started using Construct 2? Post your questions here

Post » Fri Jun 19, 2015 7:14 pm

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?
B
4
Posts: 12
Reputation: 226

Post » Fri Jun 19, 2015 7:17 pm

"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?
B
4
Posts: 12
Reputation: 226

Post » Fri Jun 19, 2015 7:25 pm

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.
B
4
Posts: 12
Reputation: 226

Post » Fri Jun 19, 2015 7:48 pm

ironmanx wrote: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?
B
4
Posts: 12
Reputation: 226

Post » Fri Jun 19, 2015 8:01 pm

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.
ImageImageImage
B
71
S
21
G
230
Posts: 3,688
Reputation: 128,847

Post » Fri Jun 19, 2015 8:56 pm

There's also the 'regenerate region' action so you don't have to regenerate the whole map.
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,650

Post » Sat Jun 20, 2015 6:07 am

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.
B
21
S
5
Posts: 44
Reputation: 1,644

Post » Mon Jun 22, 2015 4:27 pm

Shadowdawnz wrote: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?
B
4
Posts: 12
Reputation: 226

Post » Wed Jun 24, 2015 3:55 am

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.
B
21
S
5
Posts: 44
Reputation: 1,644


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 1 guest