# Unwalkable tiles using easystar, walk to nearest tile?

0 favourites
• 39 posts
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
• 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?

• Any ideas why the tiles sandwiched between tiles aren't working?

• Yes, i do.

• Yes, i do.

• 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).

• 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).

I understand, now doing this allows for something to happen when clicking a buried tile, but the player is now offset by a tile, usually diagonally? Is it possible to have the player arrive at the same tile as clicked whilst also checking buried tiles?

• Why dont you just write in events what you think ?

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

Dont give me hell for the search time for completely locked up tiles. You was warned.

• ## Try Construct 3

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

Construct 3 users don't see these ads
• Why dont you just write in events what you think ?

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

Dont give me hell for the search time for completely locked up tiles. You was warned.

Well, that works perfectly as far as I can tell, thank you! Sorry if I've been too fussy, I try to find things out by myself, but I'm really useless at intermediate programming, I spent 2 years reprogramming a webforum system with tons of help from a community, took me 60x as long as any kiddiescript coder, but I did it in the end and learned a lot!

I mean, I'm just trying to find the perfect engine for pathfinding for an adventure game, and all this great stuff is being shared with the community, which to me, is the whole point, for as many people to benefit from an idea as possible, and you've been single-highhandedly invaluable for helping me do this, and I really appreciate it! <img src="{SMILIES_PATH}/icon_e_biggrin.gif" alt=":D" title="Very Happy">

I tried earlier to find a place to figure out the equivalent of "if player is on the same tile, and therefore no pathfinding is being checked, MoveTo: mouse.x/mouse.y" to allow for pixel precision movement at any tile size, it probably would be nice to be able to go to the exact pixel clicked on within the tile, but I don't think easystar logs that info, just the tile, or am I wrong?

• Why dont you just write in events what you think ?

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

Dont give me hell for the search time for completely locked up tiles. You was warned.

Any idea what this little jiggle is that happens when you use a big sprite upon initilizing the walk? It only happens on this latest version. https://www.dropbox.com/s/yk55s50hevvph ... .capx?dl=0 (thankfully the pathfinder always just uses the hotspot rather than the sprite size!)

• 99Instances2Go Is it because the larger sprite is going to the starting tile before it begins moving/the starting node isn't at the same place as the hotspot? I can't quite work out what it looks like what is happening, even on debug, the player just seems to go back a bit before moving along the path:

• 99Instances2Go Also, it only happens on the unwalkable tiles, as can see in The gif when I click on the white space.

• Why dont you just write in events what you think ?

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

Dont give me hell for the search time for completely locked up tiles. You was warned.

It's very nearly perfect, just trying to iron this one quirk out! Can you assist? <img src="{SMILIES_PATH}/icon_rolleyes.gif" alt=":roll:" title="Rolling Eyes">

• Zebbi, i have no idea what you are doing, a .gif is not helping.

Besides that, looking at that .gif, i dont understand the use of tilemap based pathfinding with that plugin.

There is no possible path in the tilemap because the moving object (its size, and polygons) does not obey to the tilemap.

I have no idea how to make my code work in totally different environment then it is designed for.

• Zebbi, i have no idea what you are doing, a .gif is not helping.

Besides that, looking at that .gif, i dont understand the use of tilemap based pathfinding with that plugin.

There is no possible path in the tilemap because the moving object (its size, and polygons) does not obey to the tilemap.

I have no idea how to make my code work in totally different environment then it is designed for.

It does work! That's the beauty of it, the tilemap only seems to care about the base pixel or something because has worked perfectly fine! https://www.dropbox.com/s/yk55s50hevvphkd/JIGLGE.capx - the ONLY issue with the last revision is there's a strange little jiggle the player makes before moving if you click an unwalkable tile, this didn't happen in the other versions I used in this enviroment. I suppose technically I could use a tile the size of a tile and stick the player to it, but so far it's actually been working perfectly well this way! Try that capx, if you can, and on debug you can see there's a slight movement before starting along the node path if you click an unwalkable tile.

• You made some weird mix with events from both methods.

Event 57 & 58 are left overs from method 1.