猫史档案馆


虚空跑酷的弹跳如何解决

用户:虎牙工作室虎牙工作室查看:1 回复:3 评论:1 创建时间:2022-08-31T14:06:32


求助各位会JS的大佬,虚空跑酷时掉入虚空重生后会被存档点弹得很高,该如何解决


回复

上一页1 页 / 共 1下一页
我的破名一共有十个字我的破名一共有十个字

for (const e of world.querySelectorAll('*')) {//下面跳入虚空的要结合存档的代码来写
    if (e.id.startsWith('出生点')) {
        e.collides = true
        e.fixed = true
        e.onEntityContact(({ other }) => {
            if (other.isPlayer) {
                if (e.position !== other.player.spawnPoint) {
                    other.player.directMessage('到达新的重生点')
                    other.player.spawnPoint = e.position
                }
            }
        })
    }
}

world.onPlayerJoin(async ({ entity }) => {
    while (true) {
        await sleep(喵);
        if (entity.position.y <= -5) {//‘-5’是跳入虚空的高度,可以改
            entity.position.copy(entity.player.spawnPoint)//回到存档点
            entity.position.y += 4
        }
    }
})

点赞1


评论


千从千从

会不会是卡到模型里去了,把y坐标弄高一点

点赞0


评论


星光爱睡觉星光爱睡觉

谢谢你!!!emotion_编程猫_谢谢老板

 

点赞0


评论