猫史档案馆


求助【box3】存档点怎么做

用户:func.无痕func.无痕查看:4 回复:7 评论:4 创建时间:2020-08-12T11:33:37


啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊,做了好多次都失败了


回复

上一页1 页 / 共 1下一页
Moira屑玖iMoira屑玖i

顶顶

点赞0


评论


BSS梅者如西BSS梅者如西

用手做

点赞0


评论


yuansyuans

用鼠标做……

点赞0


评论


蓝buff蓝buff

 

//存档点代码
const checkPoint = {};
world.querySelectorAll('.存档点').forEach((e)=>e.onEntityContact(({entity, other}) => {

    if (other.isPlayer) {
        checkPoint[other.player.name] = entity.position;
        other.player.directMessage("存档成功!");
    }
}));

//传送点代码
world.querySelectorAll('.还原点').forEach((e) => e.onEntityContact(({entity, other}) => {

        if (other.isPlayer && other.player.name in checkPoint) {
        other.position.copy(checkPoint[other.player.name]);
        other.position.y += 5;
        }
        else{
        other.player.directMessage("您还未有存档,快去跑酷吧!");
    }
}));

//终点代码
world.querySelectorAll(".终点").forEach((e) => e.onEntityContact(({entity,other})=>{
    world.say(other.player.name+"到达了终点!获得飞行模式!");
    other.player.canFly = true;
    var yn = false
}))

点赞1


评论


方块君_大魔王_暂退方块君_大魔王_暂退

ddd

点赞0


评论


星星上的雪花星星上的雪花

用电脑做,用鼠标做

点赞0


评论


羽翼下的风羽翼下的风

for (const e of world.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
    })
})

点赞0


评论