Cocos 点击事件

    点击后向鼠标点击的位置移动


  this._playerRunSpeed = 300
       
        var that = this                  
        

this.bg.on(cc.Node.EventType.TOUCH_START,function(event){
           
            var localTouchPo = that.player.parent.convertToNodeSpaceAR(event.getLocation())
            var turnRight = localTouchPo.x > that.player.x      
                
            that._playerPlayAction("run",turnRight)
                       
            var move = cc.moveTo(cc.pDistance(localTouchPo,
                that.player.getPosition())/that._playerRunSpeed, localTouchPo)
            that.player.stopAllActions()   

你可能感兴趣的:(Cocos 点击事件)