課程
/前端開發
/HTML/CSS
/HTML5小游戲---愛心魚(下)
怎么將成績輸出到本地呢
2019-06-23
源自:HTML5小游戲---愛心魚(下) 3-9
正在回答
//分值計算
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("分數 " + 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("游戲結束", w * 0.5, h * 0.5);
ctx1.restore();
dataObj.prototype.addScore = function()
this.score += this.fruitNum * 10 * this.double;
舉報
通過一個清新美好的小游戲教程,熟悉游戲開發流程
1 回答出現這個拖尾是什么原因呢?
1 回答魚的身體怎么出不來了
2 回答為什么我的大魚碰到藍色食物就成這樣了 碰到橙色失誤完全正常的,, ??
2 回答怎樣先加載完成再打開畫面?
1 回答break循環是跳出for循環吧,而不是本次循環
Copyright ? 2025 imooc.com All Rights Reserved | 京ICP備12003892號-11 京公網安備11010802030151號
購課補貼聯系客服咨詢優惠詳情
慕課網APP您的移動學習伙伴
掃描二維碼關注慕課網微信公眾號
2020-04-07
//分值計算
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("分數 " + 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("游戲結束", 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;
}