As always there are multiple ways to do this, some involve a lot of math and some are pretty easy..
Easiest way I would know of is giving the object rotate behaviour, putting the origin outside it's image and pinning it to the player..
when wanting to move it to attack, just spawn a new object with the same animation but different behaviour and destroy the rotating one..
While this is probably the easiest way, it might not be the best performance-wise..