I'm trying to build card game using the Quintus game engine. I have objects called Card. I can touch and drag it in the screen but I want just to touch and drag it one time but I can't figure out how to disable the touch after I dragged the card and I try to Google it but no luck.

My code:

Q.Sprite.extend("Card", {

init: function(p){

        asset: "Queen_OF_Hearts.png",
        x: Q.el.width / 2,
        y: Q.el.height - 120


drag: function(touch) {
   this.p.dragging = true;
   this.p.x = touch.origX + touch.dx;
   this.p.y = touch.origY + touch.dy;

touchEnd: function(touch) {
   this.p.dragging = false;
   // put a line on the screen if the card pass it put the card in the new position if not put the card in the orginal(old) postion
   if(touch.origY + touch.dy > Q.el.height - 200) { //define the line that the card should pass if the amount of draged > the screen line in Q.el.height - 200
       // put the card in the same old postion if is not pass the line
       this.p.x = touch.origX;
       this.p.y = touch.origY;

    } else {
        // put the card if it pass the line in the new postion  
        this.p.x = Q.el.width / 2;
        this.p.y = Q.el.height - 280;


so in the else statement in the touchEnd I'm trying to do some thing like that

this.p.touch = false;

but is not working.



You must log in to answer this question.

Browse other questions tagged .