
Lv.1
QQ:3346223415
签名:我正在做‘原始枪战’这个可能会上首页但是没有联机可能需要花费好几天的时间希望大家可以喜欢!这个作品点赞过10更新,点赞过100开源全代码(或者收藏过50),这个作品我换了2次才可以的,球球了! (*╯3╰)把你们手上的赞都给我吧!点赞收藏过500或者关注我就把我的所有粉丝关注一遍!FQ不可能(╯▽╰)我的点赞不可能那么多我可能想多了……我现在长期在box3代码岛里玩所以我可能以后的作品会拖更的...
在 【岛3老活新整创作节】官方地图《赤碧城》限时送,报名时间已截止! 中回复
我要报名参赛,我的编辑地址是:https://box3.codemao.cn/e/3a1579bb6fdcde63062d
2021-04-29T17:39:34 点赞:0
在 【岛3大新闻】老活新整创作节报名截止,比赛启动! 中回复
吉吉猫看看我的作品!https://box3.codemao.cn/e/3a1579bb6fdcde63062d
2021-04-30T16:34:14 点赞:0
在 谁才是究极整活冠军?《赤碧城》老活新整获奖名单公布 中回复
2021-05-14T21:20:33 点赞:0
在 【久违的API系列教程】来啊,互相伤害吧! 中回复
console.clear();
world.onPlayerJoin(({ entity }) => {
entity.enableDamage = true; /*允许这个实体 受伤/喵亡/复活*/
entity.id = entity.player.name; /*把 玩家名字赋值到id, 以便和其它实体一样可以统一通过entity.id获取名字*/
});
world.onVoxelContact(({ entity, voxel }) => {
const voxelName = voxels.name(voxel);
if (voxelName === 'lava02'){
entity.hurt(30,{
damageType: '火焰', /*伤害类型为火焰*/
});
};
if (voxelName === 'ice'){
entity.hurt(20,{
damageType: '冰冻', /*伤害类型为冰冻*/
});
};
});
world.onTakeDamage(({ entity, damage, damageType}) => {
world.say(`${entity.id} 受到了 ${damage}点${damageType}伤害`);
});
for (const e of world.querySelectorAll('.1')) { //遍历每个僵尸实体
e.enableDamage = true //允许这个实体 受伤/喵亡/复活
e.collides = true //允许实体被碰撞
e.gravity = true //开启重力, 这样实体才不会一碰就飘走
}
world.onPlayerJoin(({ entity }) => {
entity.enableDamage = true //允许这个实体 受伤/喵亡/复活
entity.id = entity.player.name //玩家名字赋值到id, 以便和其它实体一样可以统一通过entity.id获取名字
})
world.onEntityContact(({ entity, other }) => {
if (other.id.startsWith('僵尸')) { //如果被碰实体有僵尸标签
entity.hurt(30, {
damageType: '病毒', //伤害类型为病毒
attacker: other, //告诉引擎攻击者是被碰到的这个实体
})
}
})
world.onClick(({ entity, clicker }) => {// entity是被点击的实体, clicker是点击了这个实体的玩家
entity.hurt(20, {
damageType: '喵击', //伤害类型为喵击
attacker: clicker, //告诉引擎攻击者是触发点击的这个玩家实体
})
})
world.onDie(({ entity, attacker, damageType }) => { //每次地图里有实体喵亡
if (entity.isPlayer) { //如果是玩家实体
if (damageType === '病毒') { //如果是病毒致喵
entity.player.color.set(0, 1, 0) //玩家实体颜色变绿
}
} else { //如果非玩家实体
if (damageType === '喵击') { //如果是喵击致喵
entity.destroy() //从地图上消失
}
}
})
const lava_hurt=[465,467]//触碰时被岩浆伤害的指定方块
const ice_hurt=[398,347]//触碰时被冰伤害的指定方块
const poison_hurt=[99,101]//懒得说了
world.onPlayerJoin(({entity:e/*将entity重命名为e*/})=>{
e.enableDamage=true//别忘了这玩意!
e.onVoxelContact(({x,y,z})=>{//这里onVoxelContect()必须嵌在onPlayerJoin里,否则所有实体碰到都会被伤害
const vox = voxels.getVoxelId(x,y,z)
if(lava_hurt.includes(vox)){//includes函数可以判断lava_hurt方块中是否包括vox
e.hurt(30,{damageType:'火焰_0'})//综合喆喵所讲的知识(doge)
e.player.directMessage('你收到了30点火焰伤害')
}else if(ice_hurt.includes(vox)){
e.hurt(20,{damageType:'冰冻_1'})
e.player.directMessage('你收到了20点冰冻伤害')
}else if(poison_hurt.includes(vox)){
const m =Math.floor(Math.random()*50)
e.hurt(m,{damageType:'毒素_2'})
e.player.directMessage('你收到了'+m+'点毒素伤害')
}
})
})
world.onDie(async({ entity:e,damageType }) => {
e.player.muted = true
const damtyp=damageType.split('_')//分割,以便后面进行运算
if(damtyp[1]=='0'){
e.player.color.set(1,0,0)//红色
}else if(damtyp[1]=='1'){
e.player.color.set(0,0,1)//蓝色
}else{
e.player.color.set(0,1,0)//爱色
}
world.say(`${e.player.name}收到了${damtyp[0]}伤害后不幸趋势`)//广播消息
for(i=3;i>0;i--){
e.player.directMessage(i+'秒后复活')
await sleep(1000)
}
e.player.color.set(1,1,1)
e.player.forceRespawn()
})
world.onDie(({ entity, damageType }) => {
if (damageType == "火焰") {
entity.player.color.set(1,0,0); /*玩家实体颜色变红*/
};
if (damageType == "冰冻") {
entity.player.color.set(0,0,1); /*玩家实体颜色变蓝*/
};
});2021-05-17T18:14:22 点赞:2
在 关于box3的。需帮忙! 中回复
for (const e of world.querySelectorAll('*')) {
e.collides = true //实体可以被碰撞
e.fixed = true //实体固定位置
e.onEntityContact(({ other }) => {
if (other.isPlayer) { // 如果跟当前实体碰撞的是玩家实体
e.destroy() //当前实体消失
other.player.invisible = true // 玩家皮肤隐藏
other.mesh = e.mesh // 玩家的外形换成当前实体的外形
other.meshScale.copy(e.meshScale) // 玩家外形的缩放比例设成跟当前实体一样
other.player.scale = e.meshScale.scale(e.bounds.y / other.bounds.y) //喵家的隐形碰撞盒缩放到模型刚好贴地
}
})
}
https://www.bilibili.com/video/BV1g64y1S768
在某个坐标出生的4种写法:
world.onPlayerJoin(({entity})=>{
entity.player.spawnPoint.set(4, 11, 4)
entity.player.forceRespawn()
})
world.onPlayerJoin(({entity})=>{
entity.player.spawnPoint.set(4, 11, 4)
entity.position.copy(entity.player.spawnPoint)
})
world.onPlayerJoin(({entity})=>{
entity.player.spawnPoint = new Box3Vector3(4, 11, 4)
entity.player.forceRespawn()
})
world.onPlayerJoin(({entity})=>{
entity.player.spawnPoint = new Box3Vector3(4, 11, 4)
entity.position.copy(entity.player.spawnPoint)
})
在某个模型的位置出生:
world.onPlayerJoin(({entity})=>{
entity.player.spawnPoint = world.querySelector('#出生点').position
entity.position.copy(entity.player.spawnPoint)
entity.position.y += 10
})2021-05-19T17:44:53 点赞:0
在 求代码,存档。 中回复
world.onPlayerJoin(({ entity }) => { entity.player.enable3DCursor = true // 开启方块光标 })
world.onPress(({ raycast, button }) => { if (button === Box3ButtonType.ACTION0) { const pos = raycast.voxelIndex // 射线指到的方块位置 voxels.setVoxel(pos.x, pos.y, pos.z, '') } }) world.onPlayerJoin(({ entity }) => { entity.player.enable3DCursor = true // 开启方块光标 })
world.onPress(({ raycast, button }) => { if (button === Box3ButtonType.ACTION0) { const pos = raycast.voxelIndex.add(raycast.normal) // 射线指到的方块位置加上被选中的面的法线向量 voxels.setVoxel(pos.x, pos.y, pos.z, 'stone') } }) const voxelList = ['stone', 'dirt', 'grass', 'lava01'] // 可选方块
world.onPlayerJoin(({ entity }) => { entity.selected = 0 // 当前选定方块的序号 entity.player.enable3DCursor = true // 开启方块光标 })
world.onPress(({ entity, raycast, button }) => { if (button === Box3ButtonType.ACTION0) { const vox = voxelList[entity.selected] const pos = raycast.voxelIndex.add(raycast.normal) // 射线指到的方块位置加上被选中的面的法线向量 voxels.setVoxel(pos.x, pos.y, pos.z, vox) } else if (button === Box3ButtonType.ACTION1) { entity.selected = (entity.selected + 1) % voxelList.length const vox = voxelList[entity.selected] entity.player.directMessage(`当前选定"${vox}"`) } }) world.onPlayerJoin(({ entity }) => { entity.player.enable3DCursor = true // 开启方块光标 entity.selected = 'stone' // 玩家当前选定dirt方块 })
world.onPress(async ({ entity, raycast, button }) => { if (button === Box3ButtonType.ACTION0) { const pos = raycast.voxelIndex.add(raycast.normal) // 射线指到的方块位置加上被选中的面的法线向量 voxels.setVoxel(pos.x, pos.y, pos.z, entity.selected) } else if (button === Box3ButtonType.ACTION1) { const selection = await entity.player.dialog({ type: Box3DialogType.SELECT, content: '选择方块类型', options: ['stone','dirt','grass','lava01','snow'], }) if (selection) { entity.selected = selection.value // 更新玩家当前选定方块 } } })
2021-05-19T21:08:30 点赞:0
在 找师傅了!!!!! 中回复
我能干!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
2021-05-19T21:11:51 点赞:0
在 【岛3更新了】新增“蹦蹦床”方块,不用写代码也能跳得更高 中回复
https://box3.codemao.cn/e/55225d959f912aca328a
2021-05-21T18:07:30 点赞:0