Unwalkable tiles using easystar, walk to nearest tile?

0 favourites
From the Asset Store
With this template you will learn how to use the GooglePlay Games native plugin
  • You made some weird mix with events from both methods.

    Event 57 & 58 are left overs from method 1.

    You forgot the 'on path not found' situation from method 2.

    The 'marker' is just a debug object. You know that eh.

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

    Now that is GOOD! I must have screwed up when I copied it, mistaking it for being because the object is bigger than the tile. I'm quite pleased the system inherently works by using the bottom pixel as the only reference, cos it makes it loads easier for implementing like this.

    Okay, 99Instances2Go last trick and I'm done! You've helped spectacularly on this, now there's one final question. Is there a way of being able to move the character by the pixel IF the player is already in a tile, and you're clicking within the tile? If you notice here:

    He's just moving to the pixel, that way when you click close, the character doesn't stand still, but if you click to another tile, he'll still move there with pathfinding. I think I just need to know how moveto directly to the position within the tile, if you're already at the tile you're trying to pathfind to.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 99Instances2Go alternatively, could the end node always be whatever offset to the Center of the tile you click is? That way the character should always walk even a pixel within the tile and arrive at precisely the point t on the tile clicked?

  • With a tilemap based pathfinder ? I dont see it.

  • With a tilemap based pathfinder ? I dont see it.

    But is there a way of being able to test if the player is already on the tile you've clicked, and if so, just do a straight moveto?

  • With a tilemap based pathfinder ? I dont see it.

    So, two questions:

    • Is it possible to find a path to the tile clicked + the extact position on the tile that has been clicekd for greater accuracy

    If not, then/if so, also:

    • If the player is already at the tile clicked, can we use this to do a non pathfinding MoveTo the pixel clicked on the tile?
  • 1/ Of course. Use two tilemaps. 1 for the show. Erase the tile in the base tile map, set the tile in the show tilemap, find path, when path found, set the tile in the base tilemap, erase the tile in the show tilemap.

    2/ Yeah, do as above, find path to mouse.X and mouse.Y

    But that is not gonna work for tiles that are surrounded with other tiles. Because they are obstacles. I have no idea if you have surrounded tiles. So you need 3 tilemaps.

    1 to mark the border tiles, leaving the surrounded tiles errased, use that as obstacle map.

    1 to fill the surrounded tiles.

    1 as a temporary to move tiles, that are obstacles but that you dont want to be obstacles, to. And back again.

    Alternative, once they reach the second last index of the points in the calculated path, just move them to the stored mouseX/mouseY

    But that is so way off from what you wanted in the first place.

    So, or adjust the tilemap so a path can be found. Or, make the last move a straight move to the mouse.

  • On second thought. I can not wrap my mind on that question. What you do/want is this (illustrated) :

    We stand on the side of a loch. You say: go as close as you can to that point in the water on the other side. But dont get wet, avoid water.

    I take look at the map. Loch Lomond. Loch Morar. Loch Ness. That is gonna be a serious walk.

    After 3 hours, i am there. Now you say, jump into the water to where i said that you should end the journey. So, i jump.

    But now i am wet. So i stand there in the water.

    Now you say: go as close as you can to that point in the water on the other side. But dont get wet, avoid water.

    Eh? I should have taken a boat. But then i have to avoid land.

  • On second thought. I can not wrap my mind on that question. What you do/want is this (illustrated) :

    We stand on the side of a loch. You say: go as close as you can to that point in the water on the other side. But dont get wet, avoid water.

    I take look at the map. Loch Lomond. Loch Morar. Loch Ness. That is gonna be a serious walk.

    After 3 hours, i am there. Now you say, jump into the water to where i said that you should end the journey. So, i jump.

    But now i am wet. So i stand there in the water.

    Now you say: go as close as you can to that point in the water on the other side. But dont get wet, avoid water.

    Eh? I should have taken a boat. But then i have to avoid land.

    1/ Of course. Use two tilemaps. 1 for the show. Erase the tile in the base tile map, set the tile in the show tilemap, find path, when path found, set the tile in the base tilemap, erase the tile in the show tilemap.

    2/ Yeah, do as above, find path to mouse.X and mouse.Y

    But that is not gonna work for tiles that are surrounded with other tiles. Because they are obstacles. I have no idea if you have surrounded tiles. So you need 3 tilemaps.

    1 to mark the border tiles, leaving the surrounded tiles errased, use that as obstacle map.

    1 to fill the surrounded tiles.

    1 as a temporary to move tiles, that are obstacles but that you dont want to be obstacles, to. And back again.

    Alternative, once they reach the second last index of the points in the calculated path, just move them to the stored mouseX/mouseY

    But that is so way off from what you wanted in the first place.

    So, or adjust the tilemap so a path can be found. Or, make the last move a straight move to the mouse.

    I think the most effective thing would be to, as you suggest, make a straight move to the mouse, but I don't know how to condition if the player is already on the tile. Obstacles won't be much of a problem I don't think because it only seems to care about the origin point, but it would be fun to see if the player gets stuck or not, I just don't know how to try this.

  • 99Instances2Go this'll prolly go down like a sack of hammers, but how do I reduce the tile size without the character running off to the corner of the screen when you click on an unwalkable tile?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)