为什么我的小鱼眼睛只眨一下就闭着眼睛了
//baby eye
this.babyTailTimer += deltaTime;
if(this.babyEyeTimer > this.babyEyeInterval)
{
this.babyEyeCount = (this.babyEyeCount + 1) % 2;
this.babyEyeTimer %= this.babyEyeInterval;
if(this.babyEyeCount == 1)
{
this.babyEyeInterval = Math.random() * 1500 + 2000;//[,)
}else
{
this.babyEyeInterval = 200;
}
}
还是不咋眼啊
应该是你的时间没有自循环
this.babyEyeTimer+=deltaTime; if(this.babyEyeTimer>this.babyEyeInterval){ this.babyEyeCount=(this.babyEyeCount+1)%2; this.babyEyeTimer%=this.babyEyeInterval; //时间重置 if(this.babyEyeCount==0){ //闭眼,要睁开眼睛 this.babyEyeInterval=Math.random()*1500+2000; }else{ this.babyEyeInterval=200; //睁开眼,要闭眼,眨眼 } } var babyEyeCount=this.babyEyeCount;