Unwalkable tiles using easystar, walk to nearest tile?

Get help using Construct 2

Post » Thu Dec 29, 2016 2:28 pm

Delete 21 & 22.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Thu Dec 29, 2016 3:43 pm

99Instances2Go wrote:Delete 21 & 22.

Thankyou! On a side note, and this is something I've been wondering about for a few days, is it possible to "moveto" within the tile by the pixel without pathfinding if the mouse is clicked within the same tile? So, for instance, these are pretty big tiles, would it be possible if the user clicks WITHIN the tile, the character moves to the mouse without pathfinding?

After that, I think it will be perfect! :D
B
41
S
12
G
14
Posts: 1,120
Reputation: 11,259

Post » Fri Dec 30, 2016 7:54 pm

@99Instances2Go
Would it be as easy as isolating the pathfinding to "if clicked on tile that is different to currently occupied tile" condition? I'm not sure how to do this :?
B
41
S
12
G
14
Posts: 1,120
Reputation: 11,259

Post » Fri Dec 30, 2016 10:07 pm

@99Instances2Go Also, can I adjust this so it works with smaller tile sizes? It doesn't seem to work on really low tile sizes?
B
41
S
12
G
14
Posts: 1,120
Reputation: 11,259

Post » Fri Dec 30, 2016 11:23 pm

Tried on a 2 x 2 tile. Works perfect. But. It drops in FPS with a big size tilemap, which is understandable.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Dec 31, 2016 1:35 pm

99Instances2Go wrote:Tried on a 2 x 2 tile. Works perfect. But. It drops in FPS with a big size tilemap, which is understandable.

Really? I tried that and clicking on the unwalkable tiles doesn't work anymore, it only works when you click walkable tiles, which I assumed had to do with the size of the array or something?
B
41
S
12
G
14
Posts: 1,120
Reputation: 11,259

Post » Sat Dec 31, 2016 2:45 pm

@99Instances2Go
Any ideas why the tiles sandwiched between tiles aren't working? Image
B
41
S
12
G
14
Posts: 1,120
Reputation: 11,259

Post » Sat Dec 31, 2016 3:27 pm

Yes, i do.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Sat Dec 31, 2016 3:58 pm

99Instances2Go wrote:Yes, i do.

:? Would you be so kind as to enlighten a very bad programmer such as myself, please? ;)
B
41
S
12
G
14
Posts: 1,120
Reputation: 11,259

Post » Sat Dec 31, 2016 4:43 pm

They have no free spot on a vert or hor position.

Cross the two 'loopindex("..") = 0' conditions in event 11 to have the diagonals available.
That will also mean that they are taken into account when calculating/choosing the shortest path.

Up to you if you like that or not. The results are very different. I did not like it at all in a example that i made.

Also, it will be slower. In the end, when you dont limit the search tree (and that is ALWAYS true), you end up checking to many possibilitys.
It is not a case of finding the shortest available walkable tile to the click position, that is pretty easy, you can do that on your own.
The case is to find the shortest available walkable tile that can be reached.

So, if you got a clickable tile buried deep down, and you want to check for every walkable tile arround it (dont matter how far away) if it can be reach and if it is the closest reachable, your search tree goes deep and exponential in amount of choices.

But that is up to you eh.

Now it checks just hor and vertical (4 tiles) in a simple loop. Whatever loop you want to choose will work (in exponential longer ticks).
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

PreviousNext

Return to How do I....?

Who is online

Users browsing this forum: Blendi1223 and 51 guests