Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

In My Application I Have One Arrow Image With Fix Center and i Can rotate it by touch move method on same center but i also need to Toss/trow the arrow after doing some rotation with dragging or without doing that How Can I Put The Toss/Throw Action in MyApplication

Thank You Very Much In/ advance

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Not sure about your specific application, but in general it would work like this.

float startPos = /* touchStart */;
float endPos = /* touchEnd */
float angle = atan2f(startpos.y - endpos.y, startpos.x - endpos.x);
float force = 10;

float velocityX = cosf(angle) * force;
float velocityY = sinf(angle) * force;

/** Move object every frame using velocityX / velocityY **/ 
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.