
Lv.1
在 求助!怎么清除玩家的sql数据?求你们教教我,谢谢! 中回复
db.sql`DELETE FROM 表格名称 WHERE userkey = ${要清除的玩家.player.userKey}`2023-01-03T17:29:40 点赞:0
在 ↓【惊艳】岛三出积木转代码的工具了?!(链接在下方,贴里的内容挺有意思的的,可以先看看贴里的内容) 中回复
js的功能远远大于图形化编程的功能
js其实学起来很容易,学不会那叫态度问题
2023-01-04T10:49:03 点赞:5
在 跑酷激光教程 中回复
移除函数来啦!
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),
})
}
const tick=world.onTick(()=>{//考虑到移除要把tick关了
points.forEach((e)=>{
world.searchBox(e).forEach((e)=>{
if(e.isPlayer){
e.hurt(100);
}
})
})
})
return{//给函数建立返回值,返回一个对象,里的remove方法就是移除
remove:()=>{
tick.cancel();
laser.destroy();
}
}
}
const laser = addlaser(new Box3Vector3(xxx,xxx,xxx),new Box3Vector3(xxx,xxx,xxx))//xxx表示数字
laser.remove()//移除方法2023-01-06T12:31:36 点赞:0