Pathfinding to axe a tree

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JeremiasDev

Hi, my name is Jeremias and i have a question:
How can I do that if you select any character and then select a tree, that the character runs to the tree and then the tree falls?

(on the left you can see what i mean.)

:bust_in_silhouette: Reply From: Kyle Szklenski

The easiest approach to this would be to use a Navigation2D as a parent on your TileMap node, and in your TileMap node, for the TileSet you’re working with for the grass/ground, make sure the Navigation shapes are set for all your tiles. It’s very easy then to implement navigation from one point to another with Navigation2D. Here’s a plugin I’ve made which would largely do it for you, but you’re welcome just to study the code to understand how it works as well:

Here’s a tutorial for generally using Navigation2D with TileMaps in Godot - it should get you most of the way there for this question: (Notice the version used here is very old, but should apply mostly to the current version I think.)

Hi, thank you for your answer, whats the name of the plugin? I downloaded it form Github but how can i drag it in the godot game engine? Or can i download it in Godot?

And i have a another question, how can I make that I can interact with the tree as a player, but also that it is an object where you can pass it, i.e. a non-navigable object?

JeremiasDev | 2020-12-04 18:53