
Lv.1
神射手工作室
在 【box3】检测挂机代码 中回复
varguaji=[]//会将检测到的挂机玩家的识别码加入此列表,当挂机玩家重新进入游戏时删除他的识别码world.onPlayerJoin(({entity})=>{entity.player.jilu=0entity.player.jilu2=0//一些玩家的私有变量})world.onTick(({})=>{world.querySelectorAll('player').forEach(async(e)=>{if(!guaji.includes(e.player.userKey)){//如果已经提示过玩家就不再提示了。e.player.jilu=e.positionif(e.player.jilu==e.position){//检测玩家位置是否变化e.player.jilu2+=1if(e.player.jilu2>=300){//检测玩家是否长时间位置不变化,是则判定挂机。可以改变数值以改变判定挂机的秒数,此代码默认300Tick。e.player.invisible=true//也可以根据游戏内容改为其他事件e.player.spectator=truee.player.directMessage('系统检测到你在挂机,自动退出游戏。')e.player.directMessage('若想重新加入游戏,请说“加入游戏”')//提示玩家guaji.push(e.player.userKey)}}else{e.player.jilu2=0//玩家进行移动,重新开始计算是否挂机}}})})world.onChat(({entity,message})=>{entity.player.jilu2=0//防止有些玩家因为打字而不移动位置if(message=='加入游戏'){//挂机玩家重新进入游戏if(guaji.includes(entity.player.userKey)){guaji.splice(guaji.indexOf(entity.player.userKey))entity.player.directMessage('已加入游戏')entity.player.invisible=false//取消之前对玩家的改变entity.player.spectator=false}else{entity.player.directMessage('你不在挂机!')//防止玩家不在挂机时输入此内容}}})
2021-05-26T20:10:49 点赞:0
在 【代码岛干货】摔伤代码 中回复
world.onVoxelContact(async({entity,x,y,z,voxel})=>{
if (!entity.isPlayer) return;
let i=entity.player.fall-y
if(entity.player.fall-y>15){
entity.hurt(i)
entity.player.directMessage('你受到了'+i+'点摔落伤害,目前血量是:'+entity.hp)
}
entity.player.fall=y
})2021-05-26T20:47:57 点赞:0
在 【每日一个岛3建图小技巧】有喜事了?放个烟花庆祝下! 中回复
console.clear() functionparticleSpread(entity,colorList,scale=1){ entity.particleRate=550//粒子生成速率 entity.particleLifetime=2//粒子存活时间为2秒 entity.particleColor=colorList//粒子的颜色列表 entity.particleSize=[15*scale,10*scale,5*scale,2*scale,scale]//粒子在5个阶段的大小 entity.particleSizeSpread=2*scale//粒子的大小的随机变化幅度 entity.particleVelocitySpread=[20*scale,20*scale,20*scale]//粒子XYZ方向速度的随机变化幅度 entity.particleAcceleration=[0,-10*scale,0]//粒子往下飘落模拟重力效果 } constYELLOW=newBox3RGBColor(10,10,2)//黄 constCYAN=newBox3RGBColor(2,10,10)//青 constMAGENTA=newBox3RGBColor(10,2,10)//品红 constRED=newBox3RGBColor(10,2,2)//红 constGREEN=newBox3RGBColor(2,10,2)//绿 constBLUE=newBox3RGBColor(2,2,10)//蓝 //各个颜色5个粒子阶段的颜色列表 constColorList=[ [YELLOW,YELLOW,YELLOW,YELLOW,YELLOW], [CYAN,CYAN,CYAN,CYAN,CYAN], [MAGENTA,MAGENTA,MAGENTA,MAGENTA,MAGENTA], [RED,RED,RED,RED,RED], [GREEN,GREEN,GREEN,GREEN,GREEN], [BLUE,BLUE,BLUE,BLUE,BLUE], ] functionrandomColor(){ returnColorList[Math.floor(ColorList.length*Math.random())]//随机选取一个颜色列表 } constMeshScale=[1/16,1/16,1/16]//默认的模型缩放系数 asyncfunctionparticleShoot(entity){ constfireball=world.createEntity({ bounds:[0,0,0],//隐形实体默认大小是1x1x1的方块,现在把它从方块缩成大小为0x0x0的1个点 collides:false,//开启碰撞 gravity:false,//不受重力影响 position:entity.position, }) constcolor=randomColor()//随机颜色 particleSpread(fireball,color,0.3)//粒子大小系数缩到0.3,形成小火球 awaitsleep(100)//等待0.1秒后升空 fireball.velocity.set(0,1,0)//火球速度为每秒向上1格 awaitsleep(2000)//升空2秒后爆炸 fireball.velocity.set(0,0,0)//火球停止运动 particleSpread(fireball,color,1)//系数增大到1,让火球变大 awaitsleep(1500)//大火球等待1.5秒后消失 fireball.destroy() } constfirework=world.querySelector('#新年烟花-1') firework.enableInteract=true firework.interactRadius=3 firework.onInteract(async()=>{ varn=3//每次 while(n-->0){ particleShoot(firework)//在"新年烟花-1"实体的位置发射烟花 awaitsleep(2000)//每隔2秒射1发 } })
2021-05-29T09:20:42 点赞:0
在 (代码岛3.0)岛3多功能店铺开业~ 中回复
帮忙做一个传送链接,碰到就转送的那一种
链接:https://box3.codemao.cn/e/1e33ad48262a56051bf1?p=mVx3ZuOr1YE4zFNJmgROA72shenXuyNbelt71bQBMWA5bHsz2cLwnku6PnoIHluIg%3D(一定要用Microsoft Edge打开,要不然就是“服务器中断”,我找了好几个人都是一样。)
2021-05-31T21:05:33 点赞:0
在 ✨岛三协会正式面向大家招人了!✨ 中回复
我要加入 + 技术部 并遵守职责
我岛3的名字跟我现在的一样(科技改变喵)
目前信誉100
之前的帖子不见了所以要再申请一次 (ಥ_ಥ)
2021-06-05T21:31:13 点赞:0
在 怎么放毁图喵?(我只是问问) 中回复
for (let i = 0; i < 137; i++) {
for (let j = 0; j < 128; j++) {
for (let k = 0; k < 128; k++) {
voxels.setVoxel(i, j, k, 'air')
}
}
}2021-06-08T19:55:17 点赞:0