猫史档案馆


招代码师啦

用户:Alex_tjAlex_tj查看:6 回复:3 评论:6 创建时间:2024-01-15T09:22:15


跑酷代码 合作链接喵ao.cn/e/befe5a1b8de526e377e2?p=v21oGgF3xVvKI0M67fId5XO0vqJrHD0Lx8FIgIO7JKA4Sc8H7QMQVndWVzdA%3D%3D


回复

上一页1 页 / 共 1下一页
Sherlock远星Sherlock远星

跑酷?

点赞0


评论


Arafel晓星Arafel晓星

我会跑酷代码

点赞0


评论


Arafel晓星Arafel晓星

for (const e of world.querySelectorAll('*')) {//遍历所有实体
    if (e.id.startsWith('存档点')) {//如果当前实体名左边部分刚好是"存档点", 比如 存档点-1 存档点-2...
        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(({ entity }) => {
    entity.onFluidEnter(() => {//当玩家掉到水里
        entity.player.directMessage("哇!掉进水里啦!")
        entity.position.copy(entity.player.spawnPoint)
        entity.position.y += 4
    })
})

console.clear()
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(({ entity }) => {
    entity.onFluidEnter(() => {
        if (entity.f = 1) {
            entity.player.directMessage('加油!再接再厉!')//播报存档成功,内容可以调整
            entity.position.copy(entity.player.spawnPoint)
            entity.position.y += 3.3//自己调整(不能小于1,建议不超过5)
        }
    })
})

点赞0


评论