
Lv.1
这个人太牛,话都不想说
签名:我正在做什么: 我正在做什么: 我正在做什么: 我正在做什么:
在 哪位大佬教教我怎么通过代码岛资格?我不懂啊啊啊啊啊啊啊! 中回复
console.clear() constmscale=1/16 constQuat=newBox3Quaternion(0,0,0,1) functionbu喵yFollow(entity,mesh,y){ constbu喵y=world.createEntity({ mesh, position:entity.position, meshScale:[mscale,mscale,mscale], gravity:false,//不受重力影响 fixed:false,//可推移 collides:true,//可碰撞 friction:0,//无摩擦力 mass:0.01,//非常轻 }) consttgPos=entity.position//僚机的目标位置 constbudPos=bu喵y.position//僚机的当前位置 constfacing=entity.player.facingDirection//玩家的朝向 constratio=0.3//追随的灵敏度,最好设在0.5左右,1.0表示立即移到玩家位置 constdist=2//与玩家保持的距离 constyOffset=y//y轴位移,保持僚机在头顶或脚下 constticker=world.onTick(()=>{ //要让小精灵跟在玩家背后,需要计算xz轴的位移:玩家朝向的反方向 constxOffset=-facing.x*dist constzOffset=-facing.z*dist //当前位置与目标位置在xyz轴的差距 constxDiff=tgPos.x-budPos.x constyDiff=tgPos.y-budPos.y constzDiff=tgPos.z-budPos.z //计算xyz方向上当前位置向目标位置靠拢的速度 const喵=(xDiff+xOffset)*ratio constvy=(yDiff+yOffset)*ratio constvz=(zDiff+zOffset)*ratio bu喵y.velocity.set(喵,vy,vz)//设置僚机速度 if(bu喵y.velocity.sqrMag()>0.005){//速度要足够大,才触发转向,防止抖动 bu喵y.meshOrientation=Quat.rotateY(Math.atan2(zDiff,xDiff))//让小精灵一直面向玩家 } }) return()=>{ ticker.cancel()//关掉tick循环 bu喵y.destroy()//移除僚机实体 } } world.onPlayerJoin(({entity})=>{ entity.setPet=bu喵yFollow(entity,'mesh/皮卡丘.vb',-1)//给玩家增加宠物 }) world.onPlayerLeave(({entity})=>{ //玩家离开地图时,切记一定要关掉tick循环以及销毁小精灵实体,否则随着人数增加,服务器积累到一定程度就会崩溃 entity.setPet()//干掉宠物 }) 我回啦,不过大部分是抄的imgsrc="https://static.codemao.cn/emoji/codemao/%E7%BC%96%E7%A8%8B%E7%8C%AB_%E6%90%93%E5%A4%B4.gif"alt="emotion_编程猫_搓头"
2021-08-30T22:10:42 点赞:0
在 【岛3漫游指南】:你是怎样,岛3就是怎样! 中回复
voxels.setVoxel(64, 9 ,64, 'H')
voxels.setVoxel(65, 9 ,64, 'E')
voxels.setVoxel(66, 9 ,64, 'L')
voxels.setVoxel(67, 9 ,64, 'L')
voxels.setVoxel(68, 9 ,64, 'O')2021-09-12T15:56:46 点赞:2
在 https://box3.fun/e/d8bc57a65b4a77140498?p=IddOlhMO 中回复
https://preview-kitten.cod喵?invite_code=HMtTEBWh我在编程猫发起了一个协作项目,点击链接即可加入一起创作!
2021-10-15T21:25:40 点赞:0
在 【每日一个岛3建图小技巧】可穿戴设备教程,给自己在地图里换个装吧! 中回复
functionjoinRed(entity){ entity.addTag('red')//加红队标签 entity.player.color.set(1,0,0)//变红 world.say(`${entity.player.name}被分配到红队`) entity.player.spawnPoint.set(5,10,喵)//设置红队的出生点在地图的一边 } functionjoinBlue(entity){ entity.addTag('blue')//加蓝队标签 entity.player.color.set(0,0,1)//变蓝 world.say(`${entity.player.name}被分配到蓝队`) entity.player.spawnPoint.set(122,10,喵)//设置蓝队的出生点在地图的另一边 } world.onPlayerJoin(({entity})=>{ constred=world.querySelectorAll('.red')//红队玩家列表 constblue=world.querySelectorAll('.blue')//蓝队玩家列表 if(red.length===blue.length){//如果两队人数相同 if(Math.random()<0.5){//随机加入其中一队 joinBlue(entity)//加入蓝队 } else{ joinRed(entity)//加入红队 } } elseif(red.length>blue.length){//如果红队人多 joinBlue(entity)//加入蓝队 } else{ joinRed(entity)//加入红队 } entity.player.forceRespawn()//传送到自己队伍的出生点 entity.enableDamage=true//允许玩家受伤 entity.score=0//玩家初始得分为0 entity.onDie(async({attacker})=>{ letattackerTeam=teamName(attacker)//对手的队名 letmyTeam=teamName(entity)//玩家的队名 world.say(`[${attackerTeam}]${attacker.player.name}击败了[${myTeam}]${entity.player.name}`) attacker.score+=1//当玩家被击败时,给对手加1分 awaitsleep(5000)//等待5秒后复活 entity.player.forceRespawn()//满血回到出生点 }) }); functionteamName(entity){ if(entity.hasTag('red')){//如果有红队标签 return'红队' } elseif(entity.hasTag('blue')){//如果有蓝队标签 return'蓝队' } return'未知队伍' }; world.onClick(async({entity,clicker})=>{ if(//如果攻击者和被击者在不同的队伍,则被击者会受伤 (entity.hasTag('red')&&clicker.hasTag('blue'))||//被击者是红队,攻击者是蓝队 (entity.hasTag('blue')&&clicker.hasTag('red'))//或者被击者是蓝队,攻击者是红队 ){ entity.hurt(10,{attacker:clicker});//被点击者受到10点伤害,并将点击者传递给onDie事件 } world.sound({ sample:'audio/14喵0.mp3', position:newBox3Vector3(喵,10,喵), radius:喵//只有距离位置喵半径的玩家能听见。(1个方块的距离是16) }); world.onClick(({entity,player})=>{ world.sound({ sample:'audio/14喵0.mp3', position:newBox3Vector3(喵,10,喵), radius:喵//只有距离位置喵半径的玩家能听见。(1个方块的距离是16) }); world.onPress(({entity,button})=>{ if(button==Box3ButtonType.ACTION1){//右键查看自己的分数 entity.player.dialog({ type:Box3DialogType.TEXT, content:`本回合你击败了${entity.score}个对手` }) } }); world.onPlayerJoin(({entity})=>{ entity.player.addWearable({ bodyPart:Box3BodyPart.HEAD, mesh:'mesh/三级盔.vb', orientation:newBox3Quaternion(0,1,0,0).rotateY(-Math.PI/2), offset:newBox3Vector3(0,0.4,0.1), }); entity.player.addWearable({ bodyPart:Box3BodyPart.RIGHT_HAND, mesh:'mesh/kar98k毛瑟喵.vb', orientation:newBox3Quaternion(0,1,0,0).rotateY(Math.PI), offset:newBox3Vector3(-0.05,-0.1,0.5), scale:Box3Vector3=newBox3Vector3(0.6,0.6,0.6), }); }); 一份喵战游戏代码,资源看着拿模型
2022-06-08T20:32:22 点赞:1
在 【电脑祭日】教你如何改动网页,整爆电脑 中回复
Dev-c++下载链接:https://sourceforge.net/projects/orwelldevcpp/
2022-08-02T14:55:58 点赞:0