My application fires up sprite instances around a Canvas which then move across the screen towards a x/y coordinate. I would like to be able to rotate the sprite around its center so that it faces its destination coordinates. I am using a sprite-sheet and have had issues with clipping. I have also found a lot of good examples but nothing seems to cover exactly what I'm looking for. This example is very close but for efficiency I am using an ImagePooler class and cannot reload an image on each draw/rotation. So if someone had an idea on how to rotate the preloaded image w/out cutting my sprite-sheet I would be very grateful.
First it is easy to rotate a sprite you can use canvas or matrix:
To turn it towards a destination you need to know the angle between the sprite and the destination:
Now all you need to do is to use this angle for the sprite rotation plus ajust it with a constant like angleShift which depends to where your sprite initially points.
I am not sure if this will work but hope it may give you some ideas...
using this referance to calculate Angle:
and then rotate ImageView to this angle