Sign in to follow this  

Need touch input help (freedrag)

This topic is 1415 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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;

 

 

     while (TouchPanel.IsGestureAvailable)

     {

 

          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?

Share this post


Link to post
Share on other sites
Sign in to follow this