Unwalkable tiles using easystar, walk to nearest tile?

Get help using Construct 2

Post » Tue Dec 27, 2016 8:51 pm

I've successfully used the easystar pathfinding for tilemap algorithm to make a character walk to where the mouse is click ala: pathfinding-bug-getting-out-of-an-area_p1029014?#p1029014

You'll notice in that example if you click on an unwalkable tile, the player doesn't move. Is there a way of working out the nearest walkable tile and making the player move to that, so wherever you click, the player always walks somewhere, just not through an un-walkable tile?
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Tue Dec 27, 2016 11:08 pm

Shortest path to first available tile.

https://www.dropbox.com/s/d12hf0jnyudhl ... .capx?dl=0
B
33
S
18
G
28
Posts: 2,455
Reputation: 20,874

Post » Tue Dec 27, 2016 11:09 pm

99Instances2Go wrote:Shortest path to first available tile.

https://www.dropbox.com/s/d12hf0jnyudhl ... .capx?dl=0

Ahh, thank you! I'll look at this right now and work it into my engine, was really hoping for an answer tonight, thanks so much!! R.I.P. Carrie Fisher :cry:
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Tue Dec 27, 2016 11:12 pm

99Instances2Go wrote:Shortest path to first available tile.

https://www.dropbox.com/s/d12hf0jnyudhl ... .capx?dl=0

Ooh, any way of fixing that bug when you click on the same spot twice? It sends the player to the far left corner?
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Wed Dec 28, 2016 9:09 am

Cant find that bug in my example.
B
33
S
18
G
28
Posts: 2,455
Reputation: 20,874

Post » Wed Dec 28, 2016 9:59 am

99Instances2Go wrote:Cant find that bug in my example.


If you click on he same spot twice without moving the mouse on an unwalkable tile? I think you're on the newest version of easystar?
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Wed Dec 28, 2016 11:19 am

99Instances2Go wrote:Cant find that bug in my example.

This is 1.0.1: https://dl.dropboxusercontent.com/u/700 ... p_1_01.zip
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Wed Dec 28, 2016 11:16 pm

99Instances2Go wrote:Cant find that bug in my example.

Here's the bug: Image
It's resetting the array to 0,32,32?
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Post » Thu Dec 29, 2016 8:59 am

B
33
S
18
G
28
Posts: 2,455
Reputation: 20,874

Post » Thu Dec 29, 2016 12:36 pm

99Instances2Go wrote:https://drive.google.com/open?id=0B1SSuCVV8v74UFRGQmp4dVdjaWM

Thank you! I tried to fix that, but couldn't work it out myself :? One last thing, is POSSIBLE, when you click same place twice for the box not to find a route to the other side of the tile? Right now, if you click the same spot twice, the player tries to go around to the other side of the tile, could the player, instead, stand still in the same spot? :)
B
41
S
12
G
14
Posts: 1,117
Reputation: 11,253

Next

Return to How do I....?

Who is online

Users browsing this forum: stevenode, tarek2 and 9 guests