jjzjj

ios - Sprite-kit:检测左右触摸

在我尝试构建的新游戏中,我想知道用户何时触摸了屏幕的左右两侧BOTH以执行某些逻辑操作。我的代码:overridefunctouchesBegan(touches:Set,withEventevent:UIEvent){/*Calledwhenatouchbegins*/fortouchin(touchesas!Set){letlocation=touch.locationInNode(self)varisRight:Bool=falsevarisLeft:Bool=falseif(location.xself.size.width/2){//isRight=trueprintln("