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.

I'm starting work on a 2D Android game where the player will put their finger on a game piece and do a fling gesture to throw the piece across the gameboard.

I've gone through some Android interpolation animation tutorials and have the fling working, and the game piece (currently the only item on the board) moving almost as intended.

However, I'm utterly flumoxed as to how I would work collision detection into this, as it seems to me that the fling gesture, and the resulting movement of the piece is a complete, uninterruptable action.

Are there any existing Android resources that implement 2D ball physics whilst also allowing things to be moved by flinging? The next move in the game would only be made once all game pieces had come to rest, so it's only the initial action that requires the fling.

Failing that, could someone kindly point out some good resources that might be relevant to my question? My Google hunting has pretty much just liquified my brain.

share|improve this question
add comment

1 Answer 1

The default Fling and Animations provided by the Android API are there for common animations. Here, you wan't something quite specific so I would suggest using a Fling detection as an input in a Physic simulation engine.

share|improve this answer
    
I agree, but how. How do you take speed and direction of a gesture and use it as, you say, an input into a Physics simulation engine (such as Andengine, for example)? –  JimBadger Jul 27 '11 at 15:20
1  
If you implement the OnGestureListener the onFling method will provide you with the touch down and touch up position, as well as the velocity, which you can convert in your physic engine unit. –  XGouchet Jul 28 '11 at 12:27
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.