CocosCreator小栗子

主要是了解了场景切换的API,见下:

开始场景和结束场景内,按钮挂相同的Btn脚本,主要是切换到场景2中;

Btn脚本如下,

 onLoad:function()
    {
        this.node.on('mousedown', function () {
            cc.director.loadScene('Scene1');
        });
    },

Scene1挂在场景1上,同时给与Label赋:

 properties: {
        timeLabel: {
            default: null,
            type: cc.Label
        }
    }, 

    onLoad: function () {
        var timeIn = 5;
        //倒计时  按秒计
        this.schedule(function () {
            timeIn--;
            this.timeLabel.string = timeIn;
            if (timeIn == 0)
            {
                cc.director.loadScene('Scene2');
            }
        }, 1);
    },
原文地址:https://www.cnblogs.com/allyh/p/9478259.html