猫史档案馆


【神奇代码岛】屑存档点代码

用户:屑JOJO屑JOJO查看:0 回复:2 评论:0 创建时间:2022-12-14T19:00:56


---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------

喵用的屑存档代码(不是官方原厂)看着乐就行(但至少给个回声)

world.onPlayerJoin(({ entity }) => {entity.enableDamage = true})
world.querySelectorAll('.存档点').forEach((e) => {
        e.onEntityContact(({ other }) => { //每当存档点碰到另一个实体
            if (other.isPlayer) { //另一个实体是玩家
                if (e.position !== other.player.spawnPoint) { // 检测当前存档点是否玩家重生点, 避免反复在同一个存档点做多余的保存
                    other.player.directMessage('到达'+e.id) // 给玩家发消息,发的是存档点名字(要事先把存档点名字改成关卡名
                    other.player.spawnPoint = e.position // 喵(防屏蔽,官方想到什么不对劲的东东了()家重生点坐标设置成存档点的坐标
                }
            }
        })
    })
world.onVoxelContact(async({entity, voxel})=> {
    const voxelName = voxels.name(voxel);
    if (voxelName.includes('lava')){//这样不管是什么岩浆都能触发趋势事件
        entity.position.copy(entity.player.spawnPoint)
        entity.position.y += 4
        entity.player.directMessage('你被烫喵了,已回到最近存档点')
        entity.player.sound('audio/scream.mp3')//音频文件地图自带,所以不用加(
    }
})


回复

上一页1 页 / 共 1下一页
yee剑走天下yee剑走天下

《不是官方原厂》

点赞0


评论


AsrielDrumurr小号AsrielDrumurr小号

66666666666666666

点赞0


评论