1
嗨,我是新的网页游戏开发,并试图建立纸牌游戏使用Quintus
游戏引擎我有对象称为卡我可以触摸并拖动它在屏幕上,但我只想触摸并拖动它一次,但我可以“T弄清楚如何禁用触摸后,我拖着卡和我尝试谷歌,但没有运气我的代码:如何在Quintus中禁用触摸?
Q.Sprite.extend("Card", {
init: function(p){
this._super(p,{
asset: "Queen_OF_Hearts.png",
x: Q.el.width/2,
y: Q.el.height - 120
});
this.on("drag");
this.on("touchEnd");
},
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;
}
}
});
所以在touchEnd
else语句我试图做一些喜欢的事情那
this.p.touch = false;
但不工作,所以任何帮助,如果你请提及任何sou对于Quintus
文件或书籍或Quintus
提前感谢任何良好的资源。如果你只想要一个精灵/元素
Q.untouch();
: