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

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

身體沒(méi)有變化,眼睛也沒(méi)有眨

var babyObj = function() {

this.x;

this.y;

this.angle;

this.babyEye = new Image();

this.babyBody = new Image();

this.babyTail = new Image();


this.babyTailTimer = 0;

this.babyTailCount = 0;


this.babyEyeTimer = 0;

this.babyEyeCount = 0;

this.babyInterval = 1000;


this.babyBodyTimer = 0;

this.babyBodyCount = 0;



}

babyObj.prototype.init =function(){

this.x = canWidth*0.5 -50;

this.y = canHeight*0.5 +50;

this.angle = 0;

// this.babyEye.src = "./src/babyEye0.png";

// this.babyBody.src = "./src/babyFade0.png";

// this.babyTail.src = "./src/babyTail0.png";

}

babyObj.prototype.draw = function(){

// mom

this.x = lerpDistance(mom.x,this.x,0.98);

this.y = lerpDistance(mom.y,this.y,0.98);


var deltaY = mom.y - this.y;

var deltaX = mom.x - this.x;

var beta = Math.atan2(deltaY,deltaX)+Math.PI;


this.angle = lerpAngle(beta,this.angle,0.5);


//尾巴擺動(dòng)

this.babyTailTimer += deltaTime;

if (this.babyTailTimer>50) {

this.babyTailCount = (this.babyTailCount + 1)%8;

this.babyTailTimer %=50;

};


//眨眼睛

this.babyEyeTimer += deltaTime;

if (this.babyEyeTimer > this.babyEyeIntervel) {

this.babyEyeCount =(this.babyEyeCount + 1)%2;

this.babyEyeTimer %= this.babyEyeIntervel;


if (this.babyEyeCount == 0) {

this.babyEyeIntervel = Math.random()*1500 + 2000;

}else{

this.babyEyeIntervel =200;

}

};


//身體變白

this.babyBodyTimer += deltaTime;

if (this.BabyBodyTimer > 300) {

this.babyBodyCount = this.babyBodyCount +1;

this.babyBodyTimer %=300;

if(this.babyBodyCount >19){

this.babyBodyCount = 19;

}

};


ctx1.save();

ctx1.translate(this.x,this.y);

ctx1.rotate(this.angle);

var babyTailCount = this.babyTailCount;

ctx1.drawImage(babyTail[babyTailCount],-babyTail[babyTailCount].width*0.5+23,-babyTail[babyTailCount].height*0.5);

var babyBodyCount = this.babyBodyCount;

ctx1.drawImage(babyBody[babyBodyCount],-babyBody[babyBodyCount].width*0.5,-babyBody[babyBodyCount].height*0.5);


var babyEyeCount = this.babyEyeCount;

ctx1.drawImage(babyEye[babyEyeCount],-babyEye[babyEyeCount].width*0.5,-babyEye[babyEyeCount].height*0.5);


ctx1.restore();

}


正在回答

1 回答

第一步,在main.js中加載資源,以眼睛為例子

var babyEye=[];

init(){

for(var i=0;i<2;i++){
? ?babyEye[i]= new Image();
? ?babyEye[i].src = "images/babyEye"+i+".png";
}

}


第二步,刪除baby.js中的眼睛定義

this.babyEye = new Image();

this.babyEye.src = "./src/babyEye0.png";


看你的代碼,應(yīng)該是因?yàn)闆](méi)有去除babyObj()中的資源定義:

this.babyEye = new Image();

this.babyBody = new Image();

this.babyTail = new Image();


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

qq_我在呢_0 提問(wèn)者

非常感謝!
2016-06-28 回復(fù) 有任何疑惑可以回復(fù)我~
#2

qq_我在呢_0 提問(wèn)者

后來(lái)看了一下,if (this.BabyBodyTimer > 300) 大小寫(xiě)寫(xiě)錯(cuò)了。。。。
2016-06-28 回復(fù) 有任何疑惑可以回復(fù)我~

舉報(bào)

0/150
提交
取消

身體沒(méi)有變化,眼睛也沒(méi)有眨

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

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

幫助反饋 APP下載

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

公眾號(hào)

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