猫史档案馆


找点代码师

用户:幻梦星汇幻梦星汇查看:9 回复:2 评论:9 创建时间:2022-12-03T13:34:21


做密室地图,找会做密室的代码师,

链接在下

https://box3.codemao.cn/e/30c4396bea079c8ea800?p=1xQhk55%2喵To581HQbTTXpDewl2cQ8A喵cf8g5jZFFRA6TNgF3NMAt喵250cmlidXRvcg%3D%3D


回复

上一页1 页 / 共 1下一页
屑代码师屑代码师

竟然有屏蔽词()()

点赞0


评论


一个普通的岛民一个普通的岛民

用不到的,我给你代码

密码门

const npc = world.querySelector('#阿塔');
npc.enableInteract = true; // 允许进行互动
npc.interactRadius = 16;   // 实体的互动范围
npc.interactHint = npc.id; // 互动提示框显示实体的名称
npc.interactColor = new Box3RGBColor(1,1,1);  // 互动提示的文字颜色
npc.onInteract(async({entity}) => {
    const result = await entity.player.dialog({
        type: Box3DialogType.INPUT,
        title: '阿塔',
        titleTextColor: new Box3RGBAColor(1, 1, 1, 1),
        titleBackgroundColor: new Box3RGBAColor(0, 0, 0, 0.98),
        content: `${entity.player.name},密码是什么?`,
        confirmText: '确定', // 确定按钮上面的文字。按下确定按钮后,提交回答。
        placeholder: '注意观察。', // 输入框背景上的提示文字。
        contentTextColor:  new Box3RGBAColor(1, 1, 1, 1),
        contentBackgroundColor: new Box3RGBAColor(0, 0, 0, 0.98),
        lookEye: entity.position.add(entity.player.facingDirection.scale(5)),
        lookTarget: entity,
    });

    // 如果玩家点击了屏幕其他区域,取消了对话框。
    if(!result || result === null){ 
        entity.player.directMessage('无视了我');
        return; 
    }

    const surprise = ['密码']

    if(surprise.includes(result)){
        entity.player.directMessage(`回答正确` );
        entity.position.set(133,10,183)
    }

});
console.clear()

找钥匙

const npc6c = world.querySelector('#钥匙门'); npc6c.enableInteract = true; // 允许进行互动 npc6c.interactRadius = 2;   // 实体的互动范围 npc6c.interactHint = npc6c.id; // 互动提示框显示实体的名称 npc6c.interactColor = new Box3RGBColor(1,0,1);  // 互动提示的文字颜色 npc6c.onInteract(async({entity}) => {     if(entity.mys == 1){         const result = await entity.player.dialog({         type: Box3DialogType.TEXT,   // 对话框的类型,TEXT是文本框。         title: npc6c.id,               // 对话框标题为NPC名字,表示正在说话的是NPC         lookEye: entity,             // 将相机放在玩家位置         lookTarget: npc6c,             // 相机镜头对准NPC         content: `你打开了通往出口的门`,     });     entity.position.set(5,10,17)     }else{         const result = await entity.player.dialog({         type: Box3DialogType.TEXT,   // 对话框的类型,TEXT是文本框。         title: npc6.id,               // 对话框标题为NPC名字,表示正在说话的是NPC         lookEye: entity,             // 将相机放在玩家位置         lookTarget: npc5,             // 相机镜头对准NPC         content: `你身上没有钥匙`,     });     }      }); 寻宝 const npc6 = world.querySelector('#宝箱'); npc6.enableInteract = true; // 允许进行互动 npc6.interactRadius = 2;   // 实体的互动范围 npc6.interactHint = npc6.id; // 互动提示框显示实体的名称 npc6.interactColor = new Box3RGBColor(1,0,1);  // 互动提示的文字颜色 npc6.onInteract(async({entity}) => {     if(entity.ys == 1){         const result = await entity.player.dialog({         type: Box3DialogType.TEXT,   // 对话框的类型,TEXT是文本框。         title: npc6.id,               // 对话框标题为NPC名字,表示正在说话的是NPC         lookEye: entity,             // 将相机放在玩家位置         lookTarget: npc5,             // 相机镜头对准NPC         content: `你打开了宝箱,获得了‘门钥匙’`,     });     entity.mys = 1     }else{         const result = await entity.player.dialog({         type: Box3DialogType.TEXT,   // 对话框的类型,TEXT是文本框。         title: npc6.id,               // 对话框标题为NPC名字,表示正在说话的是NPC         lookEye: entity,             // 将相机放在玩家位置         lookTarget: npc5,             // 相机镜头对准NPC         content: `你身上没有钥匙`,     });     }      });

点赞0


评论