猫史档案馆


【求助】玩家碰到水怎样回到出生点 (仅water)(回答关注+送赞+玩你所有发布的地图)

用户:百变喵啊百变喵啊查看:7 回复:8 评论:7 创建时间:2021-11-04T20:06:56


求助!

玩家碰到水返回出生点!

吉吉喵教程不一样

就是要回到最近存档点↓

entity.position.copy(entity.player.spawnPoint)
entity.position.y += 4

非常求助!

回答关注!


回复

上一页1 页 / 共 1下一页
EnderDragon(龙阁工作室)EnderDragon(龙阁工作室)

什么官方离开了自己的工作室,官方这是辞职了吗?

点赞0


评论


SDSLSDSL

for (const e of world.querySelectorAll('*')) {
    if (e.id.startsWith('存档点')) {
        e.onEntityContact(({ other }) => {
            if (other.isPlayer) {
                other.player.directMessage('已存档')
                other.player.spawnPoint = e.position
            }
        })
    }
}
world.onPlayerJoin(({ entity }) => {
    world.onVoxelContact(({ voxel, entity }) => {
        if (voxel == voxels.id('lava01')) {
            entity.position.copy(entity.player.spawnPoint)
	    entity.position.y += 4
	})
    })
}) 

Lava01改成方块名字

点赞0


评论


爱编程_编程喵喵爱编程_编程喵喵

我也想问这个问题,所以直接顶上去了

点赞0


评论


OzerOzer

合作吗?https://box3.codemao.cn/e/0e40a8d49db78c76479d?p=z8IPSCKEML4GhUSzUfSCoLbV%2FprfOEHc3sCeNNNfRkA%2FvA7SDPLwVndWVzdA%3D%3D  

点赞0


评论


爱编程_编程喵喵爱编程_编程喵喵

顶帖玩意二儿

点赞0


评论


反对盗号反对盗号

for(var y=0;y<9;y++){   for(var x=0;x<127;x++){     for(var z=0;z<127;z++){        voxels.setVoxel(x,y,z,'water')     }   } } 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.position.copy(entity.player.spawnPoint)         entity.position.y += 4     }) })

点赞0


评论


USS繁星USS繁星

这不得挖一下啊!!

center_image

点赞0


评论


企鹅vItY企鹅vItY

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.position.copy(entity.player.spawnPoint)
        entity.position.y += 4
    })
})

将模型名称的前三个字命名为“存档点”

点赞1


评论