I'm wanting to take input from touch input and use it in my Windows phone game. What I'm wanting to do is take in a player's freedrag and then apply it to a sprite. I've gotten to the point where I can apply the freedrag to a sprite with the following code:
private void Function()
TouchPanel.EnabledGestures = GestureType.FreeDrag;
GestureSample gesture = TouchPanel.ReadGesture();
if (gesture.Delta.Y < 0)
sprite.SetPositionY(sprite.GetPosition().Y + (gesture.Delta.Y * 0.5f));
sprite.SetPositionX(sprite.GetPosition().X + gesture.Delta.X);
That code works but it moves the sprite while the drag is occurring and that isn't what I'm after. What I'm wanting to do is have the player's freedrag finish before the game applies it. I've tried using:
if (gesture.GestureType == GestureType.DragComplete)
in various ways but when I do, it doesn't ever register that the drag was complete to run the code in the if statement.
Anyone know how I can go about this?