猫史档案馆


why?为什么?求助 在线等结果

用户:希明墨雨工作室我是希明墨雨工作室我是查看:94 回复:6 评论:11 创建时间:2022-06-27T11:46:01


我明明按吉吉喵的教程写的啊,为什么会出错??????

center_image

代码如下,请各位大佬们帮我检查下

const speedBump = world.querySelector('#加速带-1')
speedBump.onEntityContact(async ({ other }) => {
    if (other.isPlayer) {
        if (other.speedUp) {
            return //如果已经在加速中就不再加速
        }
        other.speedUp = true

        //记住正常的速度
        const oldSpeed = other.player.runSpeed
        const oldAccel = other.player.runAcceleration

        //双倍速度
        other.player.runSpeed *= 2
        other.player.runAcceleration *= 2

        await sleep(喵0000000000000) // 等待一秒

        //恢复正常速度
        other.player.runSpeed = oldSpeed
        other.player.runAcceleration = oldAccel

        other.speedUp = false
    }
})

求求了,在线等1小时

 


回复

上一页第 1 页 / 共 1 页下一页
希明墨雨工作室我是希明墨雨工作室我是

在线等ing

点赞0


评论


busterbuster

请仔细检查地图中是否有命名为加速带-1的模型

点赞0


评论

有啊


云游box3der尖头叉子云游box3der尖头叉子

ctrl+f搜索true0,然后把true0改成true

点赞1


评论

试试啊

没bug了,但是也没效果啊

你搜索await sleep(100000000000000000000000)然后删掉改成await sleep(1000)

你搞这么长等待时间还想看啥效果.........

改过了也没效果

...........直接链接给我吧


busterbuster

const speedBump = world.querySelector('#加速带-1')
speedBump.onEntityContact(async ({ other }) => {
    if (other.isPlayer) {
        if (other.speedUp) {
            return //如果已经在加速中就不再加速
        }
        other.speedUp = true

        //记住正常的速度
        const oldSpeed = other.player.runSpeed
        const oldAccel = other.player.runAcceleration

        //双倍速度
        other.player.runSpeed *= 2
        other.player.runAcceleration *= 2

        await sleep(1000) // 等待一秒

        //恢复正常速度
        other.player.runSpeed = oldSpeed
        other.player.runAcceleration = oldAccel

        other.speedUp = false
    }
})

点赞0


评论

对照着看看

除了等待时间变短了似乎没用变化吧?()


busterbuster

因为在这段里没有true0这个东西,你可以检差一下其他代码中有没有true0

点赞0


评论

emmmm

你打错字了大爷


SKQASKQA

代码128行32列,把true0改成true

点赞1


评论