
Lv.1
az
在 简单的存档模板 中回复
可能会报错的原因:
1. 数据类型问题(JSON不支持function、Symbol等)
2. 对象产生了嵌套(比如你的一个属性是我,我的一个属性是你)
其他的我不知道,能理解这些代码bug就可以修了,如果是我的代码的问题,可以在下面回复
2021-05-24T21:08:46 点赞:0
在 跑酷激光教程 中回复
函数写错了,应改成:
const Quat = new Box3Quaternion(0,0,0,1);
function addlaser(start,end){
const distance = start.distance(end);
const laser = world.createEntity({
mesh: 'mesh/激光.vb',
meshScale: [0.0625*distance,0.0625,0.0625],
gravity: false,
collides: false,
fixed: true,
position: start.lerp(end,0.5),
})
const d = start.sub(end);
laser.meshOrientation = Quat.rotateX(Math.atan2(d.y,Math.sqrt(d.x**2+d.z**2))).rotateY(Math.atan2(d.z,d.x));
const points = [];
for(let i=0;i<distance;i+=0.1){
points.push({
lo: start.lerp(end,0.1*distance*i),
hi: start.lerp(end,0.1*distance*i),
})
}
world.onTick(()=>{
points.forEach((e)=>{
world.searchBox(e).forEach((e)=>{
if(e.isPlayer){
e.hurt(100);
}
})
})
})
}2021-07-22T17:25:00 点赞:1
在 【box3】群岛空战找人测试啦 中回复
哦对了飞机要两个模型,一个是不会旋转的方块,用来承载玩家的cameraEntity,另一个才是飞机,不然飞机转弯的时候视野大小会变化
2021-07-25T11:43:49 点赞:3
在 【求助】倒计喵码怎么写急!!!! 中回复
world.onPlayerJoin(async({entity})=>{
entity.time = 30;
while(entity.time){
entity.time -= 1;
await sleep(1000);
}
entity.player.directMessage('倒计时结束');
})
world.querySelectorAll('.存档点').forEach((e)=>{
e.onEntityContact(({other})=>{
if(other.isPlayer && other.time){
other.player.directMessage('时间重置');
other.time = 30;
}
})
})
没试过也不知道对不对
2021-07-25T12:04:12 点赞:1
在 萌新(代码岛新制作人)的问题。 中回复
world.onPlayerJoin(({entity})=>{
entity.point = 0;
entity.onEntityContact(({other})=>{
if(!other.isPlayer){
other.point++;
}
})
entity.player.onPress(({button})=>{
if(button == 'action1'){
entity.player.directMessage('当前分数:' + entity.point);
}
})
})2021-07-25T20:14:00 点赞:0