猫史档案馆


【滑稽滑稽】送大家个编程猫皮肤~

用户:查理九世1查理九世1查看:1 回复:4 评论:1 创建时间:2020-05-27T19:58:52


center_image

shyfcka的代码,触碰触发变身~

//选中所有带有标签target的实体,并遍历循环.
world.querySelectorAll('.target').forEach((e)=>{
e.onEntityContact(({entity,other})=>{  //设置目标模型的碰撞事件.
if(!other.isPlayer){return} //防止非玩家实体参与检测.
other.mesh=entity.mesh;  //设置玩家的外观.
other.meshScale=entity.meshScale;  //设置玩家外观缩放比例.
other.player.invisible=true;  //如果模型比玩家小,就需要隐藏玩家的皮肤.
})
})

下车的说话指令

world.onChat(({ entity, message }) => {
    if (entity && entity.isPlayer) {
        if (message === '我要下车') {
            other.mesh=other;  //还原原造型
        other.player.invisible=false;//取消隐身
        other.player.canFly = false;//取消飞行
        other.player.scale = 1;//还原原形状,大小
        other.player.runSpeed=0.5;//还原原速度
        other.player.jumpPower=1;//我把跳跃力度给忘记了,有可能会出错
        world.say(other.player.name+"还原了自己");//广播信息
        
    }
})


回复

上一页1 页 / 共 1下一页
J_K_Hermione_build白泽J_K_Hermione_build白泽

wow

点赞0


评论


无限正义无限正义

厉害,又见面了

点赞0


评论


Ken李Ken李

厉害👍

点赞0


评论


千从千从

收藏

点赞0


评论