Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Multitouch!! :)
- foreach(var touchData in Touch.GetData(0)){
- float touchX = (touchData.X + 0.5f) * 960.0f;
- //If there's no racket finger ID...
- if(this.finger_ID == 0){
- //If you PRESS near the racket...
- if( (touchX > (this.x - this.touchMargin)) && touchX < ((this.x + this.touchMargin))){
- //Set the racket finger ID!!
- if(touchData.Status == TouchStatus.Down){
- this.finger_ID = touchData.ID;
- }
- }
- }
- //If the racket has a finger ID...
- if((touchData.ID == this.finger_ID) || touchData.Skip){
- //If you release the finger, the racket finger ID will be 0.
- if(touchData.Status == TouchStatus.Canceled || touchData.Status == TouchStatus.Up
- || touchData.Status == TouchStatus.None){
- this.finger_ID = 0;
- continue;
- //If you move the finger and there's a racket finger ID, just move the racket :)
- }if(touchData.Status == TouchStatus.Move){
- //If you MOVE near the racket...
- if( touchX > (this.x - this.touchMargin) && touchX < (this.x + this.touchMargin)){
- this.y = (touchData.Y + 0.5f) * 544.0f - this.h/2;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement