I have a ball sprite and I apply physics to it when the user swipes on it. I'd like the ball to start moving in the direction of the swipe.
How can I do this?
I have a ball sprite and I apply physics to it when the user swipes on it. I'd like the ball to start moving in the direction of the swipe.
How can I do this?
I have never written code for andengine but some pseudo like this may work:
OnTouch: You want to get the touch position.
OnRelease: You want to get the release position.
Theese two points can be used to create a direction vector. (The angle in between the points).
If you want, you can also use the distance between the points as force, but most likely you would like to use know how fast the user moved his finger, and you could initialize a timer on touch and stop it on release to know how fast moved his finger, and then multiply the delta-time with some speed variable.