This tutorial aims to solve the issue of setting up navigation with an AStarGrid2D on a Tilemap in Godot 4.2. Topics covered in the video are AStarGrid2D, Custom Data Layers, Movement relative to a tilemap, mouse movement.
Pathfinding is essential when looking for how to make a game because it can be used for a lot of things like enemies that follow your character or attackers in a tower defense game which have to follow a path towards the castle.
For me, this has been the easiest way of doing pathfinding in my whole game development experience with Godot, so I thought I'd share it with you.
While this is similar to my other video: https://www.youtube.com/watch?v=ztX4OV6Syn8 , it manages the pathfinding in a totally different way. Instead of using a navigation agent, it uses the AStarGrid2D for more precise pathfinding and exact tile movement.
Special thanks go to Trixie for making this amazing tileset: https://trixelized.itch.io/desert-ruins
If you want to learn more about AStarGrid2D and pathfinding in general, check out the official godot engine guides and demo projects: https://github.com/godotengine/godot-demo-projects/tree/4.0/2d/navigation_astar
--------------------
Github repository for this project:
https://github.com/cashew-olddew/godot-tutorials/tree/main/4.2/3%20-%20pathfinding%20grids%20in%20godot%204.2
Support me on Ko-Fi: https://ko-fi.com/cashewolddew
--------------------
Would you like to see something else covered next time? Make sure to leave a comment! 🥜
Chapters:
0:24 Configure AStarGrid2D
3:43 Add collisions to AStarGrid2D
6:48 Make a player move on an AStarGrid2D
11:36 Move the player on a Tilemap based on click position
16:28 Process the AStarGrid2D generated path
#gamedev #godot #pathfinding