还是习惯直接开门见山,这个游戏是有一个老师抓作弊的学生,老师背身,点学生开始加分,老师会不定时回头,如果老师回头还在点学生在,就会被抓住,游戏game over。
1、写游戏首先是loading条,于是我们就有了以下的一端js代码
function game() { var that = this; this.isStart = false; this.isFlag = true; this.percent = 0; this.init = function () { } this.loading = function (percent) { this.percent = this.percent + percent; $("#progressbarbj").css("width", this.percent + "%"); $(".game-percent").text(this.percent); if (this.percent == 100) { $(".game-loading").animate({ top: "-100%" }, 500, function () { that.isStart = true; that.start(); }); } }; this.start = function () { }; }