How do I make correct pathfinding movement?

Get help using Construct 2

Post » Thu Jul 20, 2017 8:01 pm

Basically what I am trying to do is have a sprite move to a position using pathfinding but I need it to move on a grid (the grid is made using a tilemap with the cell size for the pathfinding being the same as the tile size so no problems there). What is troubling me though is that upon clicking to move the sprite it doesn't move until I click once more eg I want to go a position I need to click twice for the object to find and start moving along the path. At first I thought it was the pathfinding that was a bit slow but afteresting it by double clicking with different time delays between the clicks that was not the case aka if I clicked fast then the object moved as soon as the second click took place but if I clicked slow then the object wouldn't move until I clicked the second time. And it wasn't the first time either. Every time I want the object to move I have to click twice.

On top of that I noticed that the pthfinding doesn't find the fastest route to the destination. Since I want the object to move in a grid I set the Diagonal movement to False which works as intended but when the object moves to a new position it just follows a straight path followed by a 90 degree turn and then another straight path to the target area (no obstacles to move around in the layout). The problem is that instead of following the closest path aka a pseudo-diagonal movement made up of multiple 90 degree turns it follows a much bigger path.

Is there an option to change these or do I have to code that my self?
B
6
Posts: 12
Reputation: 276

Post » Thu Jul 20, 2017 8:58 pm

Try a cell size = tilemap celll size / 2 & cellborder tilemap celll size / 3 to 4.
The nodes are on the grid, an accurate grid = more accurate paths.

Other plugins, specific for tilemaps :
roguelike-plugin-c2-rot-js-interface_t118452
behavior-easystar-js-pathfinding-for-tilemap_t129056
viewtopic.php?t=68958&start=0

But you will have to combine those with a method to move from node to node.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], Yahoo [Bot] and 22 guests