2D (Top Down Dungeon Crawler) Animation while following the player

I added animations to my enemy so that it looks towards the player and follows but I can’t figure out how to script it in the AI Path section and make the enemy face the player while moving. The enemy can face it multiple directions up, down, left, right, bottom right, bottom left, top left, and top right. Please can someone help me out.

Hi

The AIPath script will automatically rotate to face the desired direction. Are you saying you want to use different sprites for different directions? Or is it something else?

You can get the direction the agent is moving in by checking the ai.velocity property.

I’m using multiple sprites to do the animation

Nvm Figured it out. Thanks for your help! The way I did is by using the velocity in the AI path by using the x and y factors

1 Like