如何判断2次点击的节点名字一样

我想做连连看的效果


页面加载的时候能判断当前节点是哪个 ,下次点击的时候会输出下次的节点名字,我如果判断这2个节点一样,从而使这2个节点消除
game.js是加载在canvas上的插件,bgPrefab是红色背景预制模板aabbcc分别是连连看的小图;
以下是game.js:

cc.Class({
    extends: cc.Component,
    properties: {
        bgPrefab: {
            default: null,
            type: cc.Prefab
        },
        draw: {
            default: null,
            type: cc.Node
        },
        imgWidth:58,
        imgHeight:52,
       
    },

    // use this for initialization
    onLoad: function () {
       var x1;
       var y1;
       this.addMouse();
    },

    // called every frame, uncomment this function to activate update callback
     update: function (dt) {
         
     },
    newredbg: function(x1,y1) {
        var newbg = cc.instantiate(this.bgPrefab);
        this.node.addChild(newbg);
        newbg.setPosition(x1,y1);
     },
     removeBg:function(){
       //console.log(this.node.children);
        this.node.children[this.node.children.length-1].destroy();
     },
    addMouse:function(){
        var imgWidth=this.imgWidth;
        var imgHeight=this.imgHeight;
        this.node.on('touchstart', function (event) {
           var x1= event.getLocationX()-480;
           var y1= event.getLocationY()-320;
           if(this.node.children[this.node.children.length-1].name!="bg"){
                  if(x1>-imgWidth/2&&x1<imgWidth/2&&y1>-imgHeight/2&&y1<imgHeight/2){
                      this.newredbg(0,0);
                      console.log(this.node.name);
                  }
                  else if(x1>-imgWidth/2&&x1<imgWidth/2&&y1>imgHeight/2&&y1<imgHeight*3/2){
                      this.newredbg(0,imgHeight);
                  }
                  else if(x1>-imgWidth/2&&x1<imgWidth/2&&y1>-imgHeight*3/2&&y1<-imgHeight/2){
                      console.log(imgHeight);
                      this.newredbg(0,-imgHeight);
                  }
                  else if(x1>-(imgWidth)*3/2&&x1<-imgWidth/2&&y1>-imgHeight/2&&y1<imgHeight/2){
                      this.newredbg(-imgWidth,0);
                  }
                  else if(x1>-(imgWidth)*3/2&&x1<-imgWidth/2&&y1>imgHeight/2&&y1<imgHeight*3/2){
                       this.newredbg(-imgWidth,imgHeight);
                  }
                  else if(x1>-(imgWidth)*3/2&&x1<-imgWidth/2&&y1>-imgHeight*3/2&&y1<-imgHeight/2){
                      this.newredbg(-imgWidth,-imgHeight);
                  }
                  
            }else{
                this.removeBg();
           }
            
         }, this);
    },
});

你看下这个问题, http://forum.cocos.com/t/git/40137
里面有如何确定节点的名字一样,但是算法有问题,我做了一些修改,还是无法实现两个转弯的。(希望你做好能开源:kissing_heart: