cocos2d-js 화면 어느 위치에서든 클릭하면 구현

2381 단어 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());
    }

좋은 웹페이지 즐겨찾기