課程
/前端開發(fā)
/HTML/CSS
/HTML5小游戲---愛心魚(下)
怎么將成績輸出到本地呢
2019-06-23
源自:HTML5小游戲---愛心魚(下) 3-9
正在回答
//分值計(jì)算
var dataObj = function ()?
{
this.fruitNum = 0;
this.double = 1;
this.score = 0;
this.gameOver = false;
this.alpha = 0;
}
dataObj.prototype.draw = function()
var w = can1.width;
var h = can1.height;
ctx1.save();
ctx1.shadoBlur = 10;
ctx1.shadowColor = "white";
ctx1.fillStyle = "white";
ctx1.fillText("分?jǐn)?shù) " + this.score, w * 0.5, h - 20);
if(this.gameOver)
this.alpha? += deltaTime * 0.0005;
if(this.alpha > 1)
this.alpha = 1;
ctx1.fillStyle = "rgba(255,255,255," + this.alpha +")";
ctx1.fillText("游戲結(jié)束", w * 0.5, h * 0.5);
ctx1.restore();
dataObj.prototype.addScore = function()
this.score += this.fruitNum * 10 * this.double;
舉報(bào)
通過一個(gè)清新美好的小游戲教程,熟悉游戲開發(fā)流程
1 回答出現(xiàn)這個(gè)拖尾是什么原因呢?
1 回答魚的身體怎么出不來了
2 回答怎樣先加載完成再打開畫面?
2 回答為什么我的大魚碰到藍(lán)色食物就成這樣了 碰到橙色失誤完全正常的,, ??
1 回答break循環(huán)是跳出for循環(huán)吧,而不是本次循環(huán)
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網(wǎng)安備11010802030151號
購課補(bǔ)貼聯(lián)系客服咨詢優(yōu)惠詳情
慕課網(wǎng)APP您的移動(dòng)學(xué)習(xí)伙伴
掃描二維碼關(guān)注慕課網(wǎng)微信公眾號
2020-04-07
//分值計(jì)算
var dataObj = function ()?
{
this.fruitNum = 0;
this.double = 1;
this.score = 0;
this.gameOver = false;
this.alpha = 0;
}
dataObj.prototype.draw = function()
{
var w = can1.width;
var h = can1.height;
ctx1.save();
ctx1.shadoBlur = 10;
ctx1.shadowColor = "white";
ctx1.fillStyle = "white";
ctx1.fillText("分?jǐn)?shù) " + this.score, w * 0.5, h - 20);
if(this.gameOver)
{
this.alpha? += deltaTime * 0.0005;
if(this.alpha > 1)
this.alpha = 1;
ctx1.fillStyle = "rgba(255,255,255," + this.alpha +")";
ctx1.fillText("游戲結(jié)束", w * 0.5, h * 0.5);
}
ctx1.restore();
}
dataObj.prototype.addScore = function()
{
this.score += this.fruitNum * 10 * this.double;
this.fruitNum = 0;
this.double = 1;
}