【求助】update函数 dt 参数为0 怎么处理 ?

update:function(dt){
// 根据当前加速度方向每帧更新速度
if (this.accLeft) {
this.xSpeed -= this.accel * dt;
} else if (this.accRight) {
this.xSpeed += this.accel * dt;
}
// 限制主角的速度不能超过最大值
if ( Math.abs(this.xSpeed) > this.maxMoveSpeed ) {
// if speed reach limit, use max speed with current direction
this.xSpeed = this.maxMoveSpeed * this.xSpeed / Math.abs(this.xSpeed);
}

    // 根据当前速度更新主角的位置
                
                
    cc.log(this.dt);        
    this.node.x += this.xSpeed * dt;

},

怎么会是0呢 两帧的间隔时间为0是怎么出现的 如果真出现了 让移动速度为0也是对的呀 因为两帧的间隔为0了 那其实就是同一帧了 第二帧也没必要移动了啊

你确定是0?,你调的是this.dt

:laughing:楼主搞笑了

是我搞错了 谢谢