一、任务内容
本次主要内容为游戏主体的脚本,为重点部分。
二、具体内容及重点代码
1.初始
onLoad() {
this.success = false;
// 初始分数
this.scoreNum = 0;
},
start () {
let countDownLabel = cc.find("Canvas/bg_sprite/count_down").getComponent(cc.Label);
countDownLabel.string = this.time + "s";
this.schedule(function () {
this.time --;
countDownLabel.string = this.time + "s";
if (this.time == 0) {
cc.log("游戏结束!");
// 获取弹窗节点
let resultNode = cc.find("Canvas/result");
// 获取title和content两个节点
let titleNode = resultNode