cocos2d-js屏幕任何位置点击开始的实现

 

ctor:function () {
        this._super();
if ('mouse' in cc.sys.capabilities)
            cc.eventManager.addListener({
                event: cc.EventListener.MOUSE,
                onMouseDown: function(event){
                    event.getCurrentTarget().processEvent(event);
                }
            }, this);

        if (cc.sys.capabilities.hasOwnProperty('touches')){
            cc.eventManager.addListener({
                event: cc.EventListener.TOUCH_ALL_AT_ONCE,
                onTouchBegan:function (touches, event) {
                    event.getCurrentTarget().processEvent(touches[0]);
                }
            }, this);
        }

        return true;
    },
    processEvent:function (event) {
        cc.director.runScene(new MainScene());
    }

 

你可能感兴趣的:(cocos2d-js)