Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


Need touch input help (freedrag)


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
No replies to this topic

#1 Ulfhedhin   Members   -  Reputation: 136

Like
0Likes
Like

Posted 03 March 2014 - 04:12 PM

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?


Ulfhedhin


Sponsor:



Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS