猫史档案馆


ฅ智慧编程猫ฅ----(和平工作室室长)

ฅ智慧编程猫ฅ----(和平工作室室长)

Lv.1

大家快快关注吧! 目标:200粉500赞 ! 作品全部开源!(除重要) 预备作品中

获赞:180收藏:101浏览:3959作品收藏:95

签名:在做新的电脑(作品)

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

【分队进阶II】完善与添加玩法 中回复

修改后代码:

team=5//队数,可改
team2=["red","blue","yellow","green",'black']//队相对应的队名,可改
world.teams=[]
world.onPlayerJoin(({entity})=>{//初始化
    entity.maxHp=100
    entity.enableDamage=true
    entity.ining=0
    entity.randoms=0
    entity.mining=0
    entity.toye=0
    entity.falealow=[]
    entity.a=[]
    entity.thewords=0
    entity.leaf=0
    entity.abcdefghijklmnopqrstuvwxyz=0
})
console.clear()
function addd(){ining=1}
function adddd(a,i){abcdefghijklmnopqrstuvwxyz=a[i]}

function random(minNum,maxNum){ //随机数()()()
    switch(arguments.length){ 
        case 1: 
            return parseInt(Math.random()*minNum+1,10); 
        break; 
        case 2: 
            return parseInt(Math.random()*(maxNum-minNum+1)+minNum,10); 
        break; 
            default: 
                return 0; 
            break; 
    } 
} 
var searchInsert = function(nums, target) {//查找该数组值位置
	let arr=nums
	arr.splice(0,0,target)
	return nums.indexOf(target)>0?nums.indexOf(target):arr.sort((a,b)=>a-b).indexOf(target)
};
function toTeams(zhi,entity){
    zhi1=[1,0,2,0,0]//颜色R:
    zhi2=[0,0,2,1,0]//颜色G:
    zhi3=[0,1,0,0,0]//颜色B:
    entity.player.color.set(zhi1[zhi],zhi2[zhi],zhi3[zhi])
}
function intag(entity,aa){
    for(i in team2)entity.hasTag(team2[i]) ? adddd(team2,i) : null
    if(aa.hasTag(abcdefghijklmnopqrstuvwxyz)){
        return true
    }
    return false
}

world.onClick(({ entity, clicker ,attacker,raycast:{distance}}) => {
    if(!entity.isPlayer)return
    if(intag(clicker,entity))return
    if(distance<20){entity.hurt(10, { attacker: clicker }) //伤害
    //entity.hurt(10, { attacker: clicker }) 
    entity.player.directMessage('你受到了来自'+clicker.player.name+'的10点伤害,剩余'+entity.hp+'血量')}
})
world.onDie(async({entity,attacker})=>{
    if(!attacker||attacker==null)return
    world.say(attacker.player.name+'击杀了'+entity.player.name)
    entity.player.directMessage('3秒后复活')//复活
    await sleep(3000)
    entity.player.forceRespawn()
})
world.onPlayerJoin(async({entity})=>{
    for(var i=0;i<=team-1;i++)world.teams.push([]);//分配
    for(var i=0;i<=team-1;i++)i==0 ? entity.thewords=world.teams[i].lenth : entity.thewords==world.teams[i].lenth ? null : addd();
    if(entity.ining){//如果每队长度不相同
        for(i in world.teams)entity.a.push(world.teams[i])
        entity.mining=Math.min.apply(null, entity.a)
        for(i in world.teams) if(world.teams[i].length==entity.mining){entity.toye+=1;entity.falealow.push(team2[i])}
        entity.randoms=random(0,toye-1);
        world.teams[searchInsert(team2,entity.falealow[entity.randoms])].push(entity.player.name);
        entity.addTag(entity.falealow[entity.randoms])//添加标签,以区别相同/不相同队
        world.say(entity.player.name+'  in...'+entity.falealow[entity.randoms])//宣布队名
        toTeams(searchInsert(team2,entity.falealow[entity.randoms]),entity)//调用分队函数
        //world.say(entity.hasTag("blue"))
    }else if (entity.ining==0){//如果相同
        entity.randoms=random(0,team-1);
        world.teams[entity.randoms].push(entity.player.name);
        world.say(entity.player.name+'   in...'+team2[entity.randoms]) ;//宣布队名
        entity.addTag(team2[entity.randoms])
        toTeams(entity.randoms,entity)
        //world.say(entity.hasTag('blue'))
    }

    //world.say(teams)
})

2022-10-01T19:51:51 点赞:0

#预言家请睁眼! 中回复

box防外挂增强

2022-10-02T08:29:20 点赞:0

问大家一个和神岛无关的问题 中回复

我还没初中()()

2022-10-02T08:30:13 点赞:0

【分队进阶II】完善与添加玩法 中回复

喵d

2022-10-02T11:40:32 点赞:0

【屑求助】正则表达式 中回复

屑屑的我竟不知啥是正则表达式()

2022-10-03T14:40:14 点赞:0

有没有大佬指导一下 中回复

这啥()

2022-10-04T13:06:59 点赞:0

【F12】????????????? 中回复

F12改数字而已()

2022-10-05T09:41:37 点赞:0

一位老玩家对Box3的回忆……创作不易,看看吧qwq 中回复

我发现build最近也没来(悲

2022-10-06T10:43:43 点赞:1

这么多人看?还有这么多大佬??? 中回复

((((())))))))()()()

2022-10-07T11:54:03 点赞:0

【神岛国庆特别创作活动】七天长假做什么?让你的模型动起来! 中回复

吉吉快()

2022-10-07T13:53:07 点赞:0

【神岛国庆特别创作活动】七天长假做什么?让你的模型动起来! 中回复

吉吉现在就发皮肤吧)()

2022-10-08T09:53:05 点赞:0

【杂谈】我们所爱的那个岛…… 中回复

我看风气是治不成了()那些就在游玩端说喵,骂人()老吉一个一个整治都完不了()

2022-10-09T08:14:15 点赞:1

捉住大佬了!!! 中回复

???

2022-10-17T18:51:01 点赞:0

【神岛未解之谜】一直很忙的搬砖喵,到底在忙什么? 中回复

我似乎知道了()是模型编辑器()只是可以把模型自由移动()单独编辑()()

2022-10-17T19:32:53 点赞:0

【神岛小课堂】吉吉喵100问,但是不问吉吉喵…… 中回复

我也是策划的问题()图建筑....

2022-10-21T19:16:58 点赞:0

生日会1 跳“吉”舞 中回复

连接在哪()我也凑凑()()

2022-10-21T19:22:40 点赞:0

【神岛小课堂】吉吉喵100问,但是不问吉吉喵…… 中回复

《整活》()

吉吉教教教策划()()()(emotion_doge

2022-10-22T09:07:16 点赞:1

【崩岛】神岛崩了 中回复

emmm??((

2022-10-22T09:08:02 点赞:0

【神岛小课堂】吉吉喵100问,但是疯狂星期四回答(满满干货) 中回复

王路飞:()()()判断其他按键和自定义工具栏()咋做()

2022-10-25T20:13:45 点赞:0

真·谁是卧底游戏 中回复

盲猜B(

2022-10-25T20:17:28 点赞:0

【神岛小课堂】吉吉喵100问,但是疯狂星期四回答(满满干货) 中回复

还有还有()

王路飞:判断变量名是否含有xxx

2022-10-25T20:56:00 点赞:0

迷雾通不能注册 中回复

你试试再长亿点的(

2022-10-25T21:00:26 点赞:0

本来想做一个伪预告,结果尬了…… 中回复

真·不错()

2022-10-25T21:11:42 点赞:0

【神岛创作节】万圣节那晚,我进入了32*32的异世界…… 中回复

招人()连接私发()()()()

2022-10-29T09:06:46 点赞:0

。。。。。。 中回复

emm保重()

2022-10-31T20:32:22 点赞:0

人物动作模拟器,但是玩家动作 中回复

dddddddd()

2022-10-31T20:33:02 点赞:0

万圣新皮肤到手~ 中回复

我也有()

2022-11-08T08:01:55 点赞:0

虽迟但到,万圣创作节提名名单出炉! 中回复

wa(((

2022-11-09T20:48:26 点赞:0

【万圣节】瓜摊老板:你甜蜜劈我南瓜是吧 中回复

喵d(()()()

2022-11-09T20:50:02 点赞:0

找师傅ing…… 中回复

《教卖萌打杂》 不会(((((

((((

2022-11-10T13:38:34 点赞:0