用户:
山海kvz查看:0 回复:0 评论:0 创建时间:2022-08-02T19:47:52
也没做多少吧。。。(最后看代码) https://box3.codemao.cn/e/c3d5cb0e830efc1b342d?p=DU9H3VBrBQlT7bYNZBarJ9XKE9oYJE9nNV6r%2FRf1p7A9L0oBymMAVndWVzdA%3D%3D for(varx=0;x<300;x++){ for(varz=0;z<300;z++){ for(vary=6;y<9;y++){ voxels.setVoxel(x,y,z,'water') }}} for(consteofworld.querySelectorAll('*')){//遍历所有实体 if(e.id.startsWith('存档点')){//如果当前实体名左边部分刚好是"存档点",比如存档点-1存档点-2... e.collides=true//开启碰撞 e.fixed=true//固定实体不被推移 e.meshScale=e.meshScale.scale(2)//放大2倍 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 }) }) world.addCollisionFilter('player','player')