my game is a platform2D and i’m try make a Sword animetion play on same side the mouse
wanted to make the sword attack in the direction of the mouse on 2D Platform
my game is a platform2D and i’m try make a Sword animetion play on same side the mouse
wanted to make the sword attack in the direction of the mouse on 2D Platform
Hi,
you can check the world position of your mouse with help of Camera.ScreenToWorldPoint(). You can then calculate the direction vector or offset and check whether it is greater zero (mouse is right) or not.
If the mouse is left, you can simply flip your sprite renderer, which outputs your animation to the left.
You would probably have to adapt your collider as well though.