猫史档案馆


小橙子_

小橙子_

Lv.1

获赞:63收藏:0浏览:124作品收藏:1

签名:

回复帖子评论
上一页1 页 / 共 1下一页

神奇代码岛的新域名,由你来决定! 中回复

22222222222222

2022-06-30T20:12:27 点赞:0

不会写代码 中回复

你是学哪一种?box3可以点这个链接:欢迎来到Box3!·GitBook(codemao.cn)

2022-07-07T12:09:04 点赞:0

不会写代码 中回复

varblue_kill=0; varred_kill=0; vargun=1; vari=0; constmscale=1/16 constn=[-4,-3,-2,-1,0,1,2,3,4] world.onPlayerJoin(({entity})=>{ //设置刚进入游戏的玩家持有金币(coin)数量为0 entity.player.coin=0 //使用第一人称视角 entity.player.cameraMode=Box3CameraMode.FPS; console.log('settingcameramode:',entity.player.cameraMode); }); console.log('fp喵odeenabled'); world.onPlayerJoin(({entity})=>{ entity.player.enable3DCursor=true; }) functionkillZone(pos,radius,fn){//球状AOE if(gun==3){ for(consteofworld.querySelectorAll('*')){//遍历所有实体 constdist=e.position.distance(pos)//计算作用点与当前实体的距离 if(dist<=radius){//当距离小于等于有效作用半径 fn(e,dist)//传递当前实体和距离到回调函数并执行 } } } } for(consteofworld.querySelectorAll('*')){//遍历每个实体 e.enableDamage=true//允许这个实体受伤/喵/复活 } //利用点击事件对点中的实体造成伤害 world.onClick(({entity,clicker})=>{//entity是被点击的实体,clicker是点击了这个实体的玩家 if(entity.isPlayer){//如果被点击的是个玩家实体 world.say(`${clicker.player.name}击中${entity.player.name}`)//显示玩家的名字 i+=1 } else{ world.say(`${clicker.player.name}击中${entity.id}`)//显示实体的id i+=1 } if(i==20){ gun=2 } if(gun==1){ if(Math.random()==0){ hurts=10 } else{ hurts=20 } } if(gun==2){ if(Math.random()==0){ hurts=50 } else{ hurts=100 } } entity.hurt(hurts) killZone() }) console.clear() functionjoinRed(entity){ entity.addTag('red')//加红队标签 entity.player.color.set(1,0,0)//变红 world.say(`${entity.player.name}被分配到红队`) entity.player.spawnPoint.set(108,14,217)//设置红队的出生点在地图的一边 } functionjoinBlue(entity){ entity.addTag('blue')//加蓝队标签 entity.player.color.set(0,0,1)//变蓝 world.say(`${entity.player.name}被分配到蓝队`) entity.player.spawnPoint.set(97,14,24)//设置蓝队的出生点在地图的另一边 } 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(5)//等待5秒后复活 entity.player.forceRespawn()//满血回到出生点 }) }) functionteamName(entity){ if(entity.hasTag('red')){//如果有红队标签 return'红队' } elseif(entity.hasTag('blue')){//如果有蓝队标签 return'蓝队' } return'未知队伍' } world.onClick(({entity,clicker})=>{ if(//如果攻击者和被击者在不同的队伍,则被击者会受伤 (entity.hasTag('red')&&clicker.hasTag('blue'))||//被击者是红队,攻击者是蓝队 (entity.hasTag('blue')&&clicker.hasTag('red'))//或者被击者是蓝队,攻击者是红队 ){ entity.hurt(10,{attacker:clicker})//被点击者受到10点伤害,并将点击者传递给onDie事件 } }) world.onPress(({entity,button})=>{ if(button==Box3ButtonType.ACTION1){//右键查看自己的分数 entity.player.dialog({ type:Box3DialogType.TEXT, content:`本回合你击败了${entity.score}个对手` }) if(button==Box3ButtonType.ACTION1){ //将摄像机看向地图中心 constlookTarget=newBox3Vector3(63,8,63); //将摄像机的位置置于地图大概中心处,并往上拉升到y轴150处,确保看到完整的地形 constlookEye=newBox3Vector3(63,150,63); //lookUp用来调整相机角度,可以使画面上下左右颠倒。默认值是(0,1,0) //由于视线是俯视,需要确保lookUp与相机视线方向不平行,需修改为(1,0,0)或者(0,0,1) constlookUp=newBox3Vector3(1,0,0) entity.player.dialog({ type:Box3DialogType.TEXT, content:`俯视`, lookEye:lookEye, lookTarget:lookTarget, lookUp:lookUp }) } } })

2022-07-07T12:10:26 点赞:0

神奇代码岛联手BEYOND Expo打造元宇宙博览会 中回复

function num(){
???
}

2022-07-15T09:49:31 点赞:0

招人啊!!!急需 中回复

参加

 

2022-12-17T19:27:07 点赞:0

【我的世界模拟器 v1.00.0】素材程序文件下载入口!!! 中回复

"""https://pan.baidu.com/s/1M6sBL9vhBo6RBLnf4wz1aA"""

2023-07-08T20:26:14 点赞:0

【Python作品分享】Minecraft - 我的世界 Python Edit 【模拟】 中回复

的确

2023-10-09T19:35:39 点赞:0