(SOLVED) How do I draw a path with experimental behavior

Hi!

As far as I know, the only behavior that it works with pathfindings and collision masks from tilemaps (and tilesets) created with the program Tiled is the behavior “Obstacle for navigation mesh pathfinding (experimental)”.

The usual behavior treat the whole tilemap object as an obstacle, so I can not use it.

Of course, I need to add to the player object the correspondent behavior (“Navigation mesh pathfinding (experimental)”.

Until there, ok. But I have noticed that I can not draw the path the player is following when using that experimental behavior. Any ideas?

Thank you!

You can create your own method. This uses a variable named Counter.

2 Likes

You genius! It works! Thank you very much!

I have changed the events slightly so I can have all the lines drawn, and also one circle at the starting point. Both circles are drawn after the lines so they appear over it.

Also, I have removed the “clear after each frame” from the Shape Painter and added to the events, so it is not deleted until I release mouse press.

Thank you very much!

2 Likes

I repeated your events, and I have the following situation: after the character reaches the end point, the drawn path remains, but after pressing it is deleted, a new path is drawn, which also remains, etc. But if you set the condition that the left button is pressed, and hold the button after pressing, then the drawn path disappears as the path passes to the end point. I would like to achieve the following effect: so that the drawn path disappears as the character passes the path, without remaining, but under the condition that the mouse button is released. Any ideas? Thanks in advance.

Are you saying that you want to draw the path from the characters current position to its destination?

Yes, and also so that the drawn path disappears as the character passes this path, i.e. so that there is no longer a drawn path behind the character, but in front of the character, I hope I explained it correctly.


This is what happens after the character has already stopped.

I didn’t add the dots. This is how I tested it. First you draw a line from the current position to the next node and then you draw the other nodes.

You wouldn’t need the for each object if there’s only 1 object.

With dots.

2 Likes

Thank you very much! I will test it soon.

1 Like

Everything works as it should.

2 Likes