猫史档案馆


【你有问题吗??】我来帮你回答

用户:七式草莓七式草莓查看:110 回复:67 评论:110 创建时间:2021-08-19T09:33:59


提问方式

只要把问题发到回帖区就可以了

 

参考格式

1.问题

问题:你遇到的问题

说明:问题是详细信息(选填)

地图链接:有问题的地图的链接(选填)

代码:有问题的代码(代码问题必填)

2.BUG

BUG:你遇到的BUG

说明:BUG是详细信息(选填)

地图链接:有BUG的地图的链接(选填)

代码:有BUG的代码

 

要求

1.不能问算法!!(有算法问题找YDS)

2.不能问太水的问题!!

3.不能问现实上的问题!!

4.不准问除JS以外的代码问题!!

5.不准问网页的JS!!

6.不准问违规的问题!!


回复

上一页1 页 / 共 3下一页
成熟的强袭编程猫548成熟的强袭编程猫548

沙发

点赞0


评论


时当日色QWQ时当日色QWQ

地板

点赞0


评论


指令者指令者

跨地图建设系统在哪里(链接)

点赞0


评论


凌_墨水凌_墨水

炸弹喵是怎么做到非实体模型造成伤害的 也就是两非实体的实体进入所触发的事件触发器 这种方式的原理是什么,如何做到 求解

点赞0


评论


Forzen_SevenForzen_Seven

“你有问题吗??”

点赞0


评论


萌新大佬萌新大佬

求助

点赞0


评论


七式草莓七式草莓

@ 萌新大佬

world.querySelectorAll('.模型标签').forEach((e) =>  {
    e.enableInteract = true
    e.onInteract(async({ entity }) => {
        let result = await entity.player.dialog({
            type: Box3DialogType.SELECT,
            title: '',
            content: ``,
            options: ['']
        })
        if(!result || result === null) return
        switch(result.value){}
    })
})

点赞0


评论


指令者指令者

发射激光怎么做(有模型旋转,碰到5伤害)

点赞0


评论


HYS王权超级威威HYS王权超级威威

请问一下,怎么搞一个对话的代码,就是一进入游戏给个对话框,上面我要写游戏规则

点赞0


评论


化石茄子的铁镐化石茄子的铁镐

求怎么碰到ice_brick开始计时,碰到carpet_08结束计时,把计时数据SQL保存,制作排行榜行不行awa

 

点赞1


评论


天真的小电鼠hgvh天真的小电鼠hgvh

大佬,碰到实体就喵代码咋写? imgsrc="https://static.codemao.cn/emoji/codemao/%E7%BC%96%E7%A8%8B%E7%8C%AB_%E7%BF%BB%E7%99%BD%E7%9C%BC.gif"alt="emotion_编程猫_翻白眼"

点赞1


评论


七式草莓七式草莓

@ HYS王权超级威威 碰实体死.亡代码

world.onPlayerJoin(({entity})=>{
    entity.enableDamage=true
    entity.onEntityContact(()=>{
        entity.hp=0
    })
})

点赞0


评论


指令者指令者

1.武器试验场烈焰的代码是什么(上次那个好多BUG,就改成火球吧)

2.如何把一个建筑复制到另一个地图里

点赞0


评论


七式草莓七式草莓

@ 指令者 地形打包器

setTimeout(async() => {
console.clear();
console.log(`---------------元七七地形打包器--------------\n作者:元七七\n状态:运行中\n操作方法:\n提示:你可以直接把打包的地形数据输入到控制台`);
console.error('警告:不要把打包的地形数据输入到代码区!');
console.log(`--------元七七地形打包器-选择区域--------\n请用鼠标左键点击要打包区域的起点`);
world.querySelectorAll('player').forEach((e) => {
e.player.canFly = true;
e.player.enable3DCursor = true;
e.player.enableAction0 = true;
});
var button1 = await world.nextPress(({button}) => (button == Box3ButtonType.ACTION0));
while(button1.raycast.hitVoxel == 0){
console.warn('请重新点击');
world.querySelectorAll('player').forEach((e) => {
e.player.canFly = true;
e.player.enable3DCursor = true;
e.player.enableAction0 = true;
});
button1 = await world.nextPress(({button}) => (button == Box3ButtonType.ACTION0));
};
console.log('你点击了坐标为 x:' + button1.raycast.voxelIndex.x + ' y:' + button1.raycast.voxelIndex.y + ' z:' + button1.raycast.voxelIndex.z);
console.log(`请用鼠标点击要打包区域的终点`);
world.querySelectorAll('player').forEach((e) => {
e.player.canFly = true;
e.player.enable3DCursor = true;
e.player.enableAction0 = true;
});
var button2 = await world.nextPress(({button}) => (button == Box3ButtonType.ACTION0));
while(button2.raycast.hitVoxel == 0){
console.warn('请重新点击');
world.querySelectorAll('player').forEach((e) => {
e.player.canFly = true;
e.player.enable3DCursor = true;
e.player.enableAction0 = true;
});
button2 = await world.nextPress(({button}) => (button == Box3ButtonType.ACTION0));
};
console.log('你点击了坐标为 x:' + button1.raycast.voxelIndex.x + ' y:' + button1.raycast.voxelIndex.y + ' z:' + button1.raycast.voxelIndex.z);
console.log(`-----元七七地形打包器-读取地形数据-----`);
const loX = Math.min(button1.raycast.voxelIndex.x, button2.raycast.voxelIndex.x);
const loY = Math.min(button1.raycast.voxelIndex.y, button2.raycast.voxelIndex.y);
const loZ = Math.min(button1.raycast.voxelIndex.z, button2.raycast.voxelIndex.z);
const hiX = Math.max(button1.raycast.voxelIndex.x, button2.raycast.voxelIndex.x);
const hiY = Math.max(button1.raycast.voxelIndex.y, button2.raycast.voxelIndex.y);
const hiZ = Math.max(button1.raycast.voxelIndex.z, button2.raycast.voxelIndex.z);
console.log('即将打包在坐标 x:' + loX + ' y:' + loY + ' z:' + loZ + ' 和坐标 x:' + hiX + ' y:' + hiY + ' z:' + hiZ + ' 之间的所有地形数据');
await sleep(2500);
console.log('正在处理中,请稍后……');
var data = [];
for(let x = loX;x <= hiX;x++){
for(let y = loY;y <= hiY;y++){
for(let z = loZ;z <= hiZ;z++){
if(voxels.getVoxelId(x, y, z) != 0){
data.push(JSON.stringify({x: x - loX, y: y - loY, z: z - loZ, id: voxels.getVoxelId(x, y, z), ro: voxels.getVoxelRotation(x, y, z)}));
};
};
};
await sleep(25)
};
world.say(`
var sx = {x:-1, y:-1, z:-1};
/* 元七七地形打包器-构建代码 打包器所有者:元七七 说明:请勿放到代码区!!*/
setTimeout(async function(){
console.clear();
console.log(\`-----元七七地形打包器-打包地形文件-----\`);
console.log(\`打包器作者:元七七\`);
console.log(\`状态:运行中\`);
if(sx.x==-1){
if(sx.y==-1){
if(sx.z==-1){
console.log(\`-------元七七地形打包文件-选择坐标------\`);
console.log(\`请用鼠标左键点击要建造的坐标的最低端(建筑预览,必须在运行中操作!如确认建造,请更改sx变量为坐标(后面会显示的))\`);
world.querySelectorAll(\'player\').forEach(function(e){
e.player.canFly = true;
e.player.enable3DCursor = true;
e.player.enableAction0 = true;
});
var button1 = await world.nextPress/* 防屏蔽 */(function({button}){
return(button == Box3ButtonType.ACTION0)
});
while(button1.raycast.hitVoxel == 0){
console.warn(\'请重新点击\');
world.querySelectorAll(\'player\').forEach(function(e){
e.player.canFly = true;
e.player.enable3DCursor = true;
e.player.enableAction0 = true;
});
button1 = await world.nextPress/* 防屏蔽 */(function({button}){
return(button == Box3ButtonType.ACTION0);
});
};
console.log('你点击了坐标为 x:' + button1.raycast.voxelIndex.x + ' y:' + button1.raycast.voxelIndex.y + ' z:' + button1.raycast.voxelIndex.z);
sx = {x:button1.raycast.voxelIndex.x, y:button1.raycast.voxelIndex.y, z:button1.raycast.voxelIndex.z}
}
}
};
console.log(\`-------元七七地形打包文件-开始建造------\`);
console.log(\`建造中,请稍后……\`);
for(let i of [${data}]){
voxels.setVoxelId(i.x + sx.x, i.y + sx.y, i.z + sx.z, i.id, i.ro);
await sleep(0.1);
i++;
if(i % 1000 == 0){
console.log('建造进度:' + (Math.round((i / data.length) * 10000) / 100) + '%')
}
};
console.log(\`建造成功!\`);
}, 1);
`);
console.log(`-----元七七地形打包器-输出地形数据-----`);
console.log('见聊天区');
console.log('PS:\n如何复制输出内容:\n1.打开聊天区\n2.打开开发人员工具(一般都在浏览器菜单里)\n3.找到body的那个,点击左面的展开(一般已经展开了)\n4.找到div id=\"edit-react\"的那个,用一样的方法展开,然后再展开一次\n5.展开倒数第二个\n6.展开第二个\n7.展开第一个,然后再展开一次\n8.展开第二个\n9.展开第一个\n10.展开倒数第一个,右键然后Edit as HT' + 'ML,按下Ctrl+a后按下Ctrl+c复制')
}, 1);

点赞0


评论


七式草莓七式草莓

@ 指令者 发射激光代码(改良版,激光不会弹开)

/**
 * @param {Box3Vector3} direction
 */
function pointTowards(direction) {
    return new Box3Quaternion(0, 0, 0, 1)
        .rotateX(Math.atan2(direction.y, Math.sqrt(direction.x ** 2 + direction.z ** 2)))
        .rotateY(Math.atan2(direction.z, direction.x))
}


/**
 * @param {Box3Entity} entity
 * @param {number} speed
 * @param {Box3Vector3} startPosition
 * @param {Box3Vector3} endPosition
 */
function laserMovement(entity, speed, startPosition, endPosition) {
    entity.fixed = false
    var Direction = endPosition.sub(startPosition);
    var dist = Direction.mag()
    entity.velocity.x = Direction.x * speed / dist
    entity.velocity.y = Direction.y * speed / dist
    entity.velocity.z = Direction.z * speed / dist
    entity.meshOrientation = pointTowards(entity.velocity)
}


/**
 * @param {Box3Vector3} startPosition 起点位置
 * @param {Box3Vector3} endPosition 终点位置
 * @param {number} speed 速度
 * @param {Box3Vector3} direction 方向
 * @param {string} entityMesh 模型外观文件
 * @param {boolean} entityCollides 模型是否有碰撞
 * @param {string[]} entityTags 模型的标签(方便识别)
 * @param {string} entityId 模型的名字(用于防止激光弹开)
 */
function emittingLaser(startPosition, endPosition, speed, direction, entityMesh, entityCollides, entityTags, entityId = undefined) {
    let entity = world.createEntity({
        id: entityId,
        position: startPosition,
        mesh: entityMesh,
        collides: entityCollides,
        tags: entityTags,
        fixed: false,
        gravity: false,
        meshOrientation: pointTowards(direction)
    });

    (async () => {
        while (entity.position.distance(endPosition) > 0.5 && !entity.destroyed) {
            laserMovement(entity, speed, entity.position, entity.position.add(direction.scale(5)))
            await sleep(100)
        }

        entity.destroy()
    })()

    return entity
}


world.onPlayerJoin(({ entity }) => {
    entity.id = entity.player.userKey
    world.addCollisionFilter(`#${entity.player.userKey}`, `#${entity.player.userKey}`)
})

world.onPlayerLeave(({ entity }) => {
    world.removeCollisionFilter(`#${entity.player.userKey}`, `#${entity.player.userKey}`)
})

world.onPress(({ entity, button, raycast }) => {
    if (button === Box3ButtonType.ACTION0) {
        /* 生成激光 */
        let laser = emittingLaser(entity.position, raycast.hitPosition, 2.5, raycast.direction, 'mesh/激光.vb', true, ['激光'], entity.player.userKey)

        /* 激光碰方块就消失 */
        laser.onVoxelContact(() => {
            laser.destroy()
        })

        /*
         * 以下为激光PVP的程序
         */

        laser.onEntityContact(({ other }) => {
            if(other.isPlayer){
                other.hurt(5, {
                    attacker: entity,
                    damageType: '激光伤害'
                })
            }
        })
    }
})

world.onPlayerJoin(({ entity }) => {
    entity.enableDamage = true
})

/* 杀死就重生 */
world.onDie(({ entity, attacker, damageType }) => {
    if(entity.isPlayer && attacker && attacker.isPlayer){
        world.say(`${entity.player.name} 被 ${attacker.player.name} 杀死了`)
        entity.player.forceRespawn()
    }
})

点赞0


评论


MrAssMrAss

我想问,你是人吗

点赞0


评论


寂梦晨风寂梦晨风

你喵吗(这个喵是我手动打上去的)

点赞0


评论


执灯三千明_执灯三千明_

为什么我在源码3和源码4拼接一样的积木,源码3能正常运行源码4不行啊,客户端和谷歌都是这样(难道是我打开的方式错了?)

点赞0


评论


云游box3der尖头叉子云游box3der尖头叉子

怎么把自己的userKey切换成别人的

点赞0


评论


飞熊jSrt飞熊jSrt

center_image

点赞0


评论


飞熊jSrt飞熊jSrt

问题:你有问题吗?emotion_doge

点赞0


评论


想不出来叫什么想不出来叫什么

辣个怎么复制建筑?

 

点赞0


评论


繁星迷雾繁星迷雾

《你有问题吗??》の奇妙冒险

点赞0


评论


爱探险的可乐呀爱探险的可乐呀

node怎么创建服务器(((

点赞0


评论


七式草莓七式草莓

新增规定:禁止问BOX3以外的内容!!

点赞0


评论


一个STUB用户_6923702一个STUB用户_6923702

Box3JS如何不用SQL云存档emotion_doge

点赞0


评论


化石茄子的铁镐化石茄子的铁镐

怎么制作特效

点赞0


评论


超能编程喵超能编程喵

请问如何在box3用代码发射东西? 链接:https://box3.codemao.cn/e/6fd9a63ba26c19e55303?p=mc6b3nPvQ2Opkw6PyK7ctDDR%2B%2Bl3yYFYlbFnxrLc0bA5SlmHq4Lwt喵250cmlidXRvcg%3D%3D

点赞0


评论


清瞑月风GUI清瞑月风GUI

超时空对决的单兵火箭炮代码怎么打?是不是需要用到射线检测?

点赞0


评论


VernierVernier

《你有问题啊》

点赞1


评论