第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

score 打印在canvas時(shí)當(dāng)檢測(cè)到碰撞時(shí),score 會(huì)重復(fù)畫(huà),一直累加為什么會(huì)這樣?求解答

http://img1.sycdn.imooc.com//58e8de7f0001d83213660768.jpg

var?dataObj=function(){
??this.score=0;
this.ntrNum=0;
this.gameover=false;
}

dataObj.prototype.draw=function(){
??//?var?w=can1.width;
??//?var?h=can1.height;

??ctx1.fillStyle?=?"white";

??//?ctx1.fillText=("score"+this.score,canWidth*0.5,canHeight/12);
????ctx1.fillText("score??"+this.score,canWidth*.5,canHeight-20);
????ctx1.fillText("ntrNUm??"+this.ntrNum,canWidth*.5,canHeight-50);

console.log(this.score)

}

??dataObj.prototype.addScore=function(){
????//?if(this.ntrNum>0){
??????this.score+=this.ntrNum*10;
????//?}
????this.ntrNum=0;

??}


正在回答

1 回答

不知道你的代碼結(jié)構(gòu)是不是跟視頻里的差不多,視頻里gameloop()這個(gè)函數(shù)一直在循環(huán),而data.js里的draw()一直再被gameloop()調(diào)用,draw()里有score的繪制,因此會(huì)一直被重復(fù)繪制。而你的累加,有可能是因?yàn)轸~(yú)媽媽跟小碰撞檢測(cè)的條件沒(méi)有寫(xiě)清楚。

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

score 打印在canvas時(shí)當(dāng)檢測(cè)到碰撞時(shí),score 會(huì)重復(fù)畫(huà),一直累加為什么會(huì)這樣?求解答

我要回答 關(guān)注問(wèn)題
微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢(xún)優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)