How do I make pathfinding work correctly?

Get help using Construct 2

Post » Thu Apr 20, 2017 6:56 pm

Okay, first off, i know title doesnt explain really well, but I'm having this problem. I tried a sprite with the pathfinding behaviour, so when you click on it, you choose somewhere in the map with the mouse, and the sprite moves there. It was all working good in a blank project sheet, but as soon as i put obstacles in (with solid behaviour), the pathfinding sprite won't move. Whenever I tell it to go like, 10 feet in front of it, it works, but when i tell it to go at the other side of a wall, it stops working.
I know i dont explain very well, but i hope you understand "^^
B
4
S
1
Posts: 20
Reputation: 388

Post » Fri Apr 21, 2017 7:42 am

TheCreepy12 wrote:Okay, first off, i know title doesnt explain really well, but I'm having this problem. I tried a sprite with the pathfinding behaviour, so when you click on it, you choose somewhere in the map with the mouse, and the sprite moves there. It was all working good in a blank project sheet, but as soon as i put obstacles in (with solid behaviour), the pathfinding sprite won't move. Whenever I tell it to go like, 10 feet in front of it, it works, but when i tell it to go at the other side of a wall, it stops working.
I know i dont explain very well, but i hope you understand "^^


Trying to fix pathfinding problems from just an explanation is nearly impossible - there are just too many things that could be wrong, e.g. cell size.

It would make it much quicker if you provide a .capx which highlights your problem.

BTW does the built-in pathfinding examples work correctly for you? If so, you may be able to see where you have gone wrong.
If your vision so exceeds your ability, then look to something closer.
Moderator
B
137
S
31
G
87
Posts: 5,548
Reputation: 60,440

Post » Fri Apr 21, 2017 5:03 pm

zenox98 wrote:
TheCreepy12 wrote:Okay, first off, i know title doesnt explain really well, but I'm having this problem. I tried a sprite with the pathfinding behaviour, so when you click on it, you choose somewhere in the map with the mouse, and the sprite moves there. It was all working good in a blank project sheet, but as soon as i put obstacles in (with solid behaviour), the pathfinding sprite won't move. Whenever I tell it to go like, 10 feet in front of it, it works, but when i tell it to go at the other side of a wall, it stops working.
I know i dont explain very well, but i hope you understand "^^


Trying to fix pathfinding problems from just an explanation is nearly impossible - there are just too many things that could be wrong, e.g. cell size.

It would make it much quicker if you provide a .capx which highlights your problem.

BTW does the built-in pathfinding examples work correctly for you? If so, you may be able to see where you have gone wrong.


Okay, i would provide the cap, but I'm kinda new to the forums and I don't know how, could you explain me? If so I'll do it
B
4
S
1
Posts: 20
Reputation: 388

Post » Fri Apr 21, 2017 8:33 pm

@TheCreepy12 Does it work if you set the cell size to a smaller value? Like 5 or something
B
58
S
25
G
14
Posts: 792
Reputation: 13,300

Post » Fri Apr 21, 2017 8:57 pm

Anonnymitet wrote:@TheCreepy12 Does it work if you set the cell size to a smaller value? Like 5 or something

I've actually tried setting it to even 1, still doesn't respond, I'm going to try and explain what I say with a "drawing"
So, If i tell the sprite to go from point A, to point B "[ A -----> B ]" it works, but when i tell the sprite to go from A to B, with a wall in front, it doesnt "[ A ---[]---> B]"
I hope you understand better with that kind of explanation, and obviously, there is more space up and down for the sprite to move
B
4
S
1
Posts: 20
Reputation: 388

Post » Fri Apr 21, 2017 10:33 pm

Try this:

On click --> calculate path to destination

then

On path found ---> move along path


Make sure that your obstacles has the solid bahaviour and also solids is added as a obstacle in the pathfinding behaviour
B
58
S
25
G
14
Posts: 792
Reputation: 13,300


Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 4 guests