how to swipe on any direction as per image

i need a script to swipe a ball on any direction as show in image for mobile games.

What have you written so far? Is it not working correctly? What have you tried?

I have no idea

how to start …