最近搜索

第12讲 添加开屏界面

浏览:439
管理员 2021-08-21 02:35


创建一个新场景  sence(gg)

image.png


放一个精灵当背景  放一个按钮关闭加时间 

image.png



新建一个js脚本 gg

image.png


在脚本定义 label 计时数字label

image.png



添加计时器

cc.Class({
    extends: cc.Component,

    properties: {
        label_num:cc.Label
    },

    // LIFE-CYCLE CALLBACKS:

    onLoad () {
        this.time_num = 10;
        this.schedule(function(){
            console.log(1);
            this.label_num.string = this.time_num;
            this.time_num--;
            if(this.time_num==0){
                this.go_to_game();
            }
        },1);
    },
    go_to_game(){

    },
    start () {
    },

    // update (dt) {},
});



加载场景  切换场景

image.png





联系站长

站长微信:xiaomao0055

站长QQ:14496453