Pathfinding (NPC Follows Player/Aggro Monsters) - How to Make a 2D Game in Java #40
If you want to learn how A* algorithm works, please check:
https://youtu.be/2JNEme00ZFA
In this video we will implement a pathfinding algorithm so NPCs/enemies can search the path and reach a specified location/target.
What we do this time:
- Guiding an NPC to a different location
- Letting an NPC follow you
- Making monsters start attacking/chasing you
If you want to use my asset (images/maps/sound) that are used in this tutorial, here's the link:
https://drive.google.com/drive/folders/1OBRM8M3qCNAfJDCaldg62yFMiyFaKgYx?usp=sharing
*If you wish to use them to create public content (profitable/non-profitable), please contact me via Twitter or email. Both links are in the About section of this channel. In any case PLEASE DON'T re-distribute my asset (graphics/sound) and limit it to personal use.
Timestamps:
0:00 Introduction
1:38 Creating Node class
2:50 Creating Pathfinder class
19:36 Letting NPC finds the path
35:03 Drawing the path on the screen
37:16 NPC follows the Player
39:06 Monsters get aggro and chase the Player
44:21 FINAL RESULT