猫史档案馆


咳咳,玩家颜色教程代码

用户:datacatdatacat查看:26 回复:26 评论:26 创建时间:2020-04-15T14:17:44


求吉吉喵给个教程吧,我在为工作室升级

这次的教程我们加个作者,也就是红蓝绿三个队伍。

首先,大家知道3原色吧,玩家的颜色就是通过3原色做成的

entity.player.color.r=1;
entity.player.color.g=0;
entity.player.color.b=0;

就像这样,r(red),g(gree),b(blue)

emotion_编程猫_点赞

而后面的数字,决定你的颜色,用三原色做成你想要的颜色

但有些时候两方玩家差距大,怎么才能公平呢

emotion_雷电猴_举手

用下面这个代码:

 if(teem_red.length!=teem_blue.length){
            if(teem_red.length<teem_blue.length){

什么意思呢,简单来说就是如果蓝方玩家多余红方玩家,那么将这个玩家归于红队。

然后设置个队玩家血量

entity.maxHp=500;
 entity.hp=500;

但双方不能出生在一个地方,所以...看代码吧

emotion_编程猫_冷漠

teem_red.push(entity.player.name);
                entity.position.set(63, 14, 86);
                entity.player.spawnPoint.copy(entity.position);

在每个队代码下面加这个代码,就能让两方出生点不一样了

emotion_编程猫_厉害了

entity.position.set(63, 14, 86);

再补一个,随机分队的代码。

其实很简单,用随机数代码即可(random)

if(Math.round(Math.random())===1)

emmmm,没加{...你们加在后边就行了,嘿嘿

emotion_编程猫_溜了溜了

最后的结束代码大家自己加吧

emotion_编程猫_加油

emmmm,算了,我还是发一个是列代码吧,看好了

var super_player_name=new Array();
//super_player_name.push('人工智能AI');
super_player_name.push('一个XXX');
super_player_name.push('代码岛3加油');
//super_player_name.push('GOLDEN_EXPERIENCE');
//super_player_name.push('长着利爪的小猫');
//super_player_name.push('谢谨鸿Rsne');
//super_player_name.push('谢谨鸿');

world.onPlayerJoin(({entity})=>{
    if(contains(super_player_name,entity.player.name)){
        entity.player.canFly=true;
        world.say('欢迎作者'+entity.player.name+'进入游戏!');
    }
    entity.player.directMessage(entity.player.name+',欢迎来到海上对决');
    if(contains(super_player_name,entity.player.name)){
         
    } else{
        if(teem_red.length!=teem_blue.length){
            if(teem_red.length<teem_blue.length){
                entity.player.color.r=1;
                entity.player.color.g=0;
                entity.player.color.b=0;
                entity.maxHp=500;
                entity.hp=500;
                teem_red.push(entity.player.name);
                entity.position.set(63, 14, 86);
                entity.player.spawnPoint.copy(entity.position);
            } else{
                entity.player.color.r=0;
                entity.player.color.g=0;
                entity.player.color.b=1;
                entity.maxHp=500;
                entity.hp=500;
                entity.position.set(喵, 15, 33);
                entity.player.spawnPoint.copy(entity.position);
                teem_blue.push(entity.player.name);
            }
        } else{
            if(Math.round(Math.random())===1){
                entity.player.color.r=1;
                entity.player.color.g=0;
                entity.player.color.b=0;
                entity.maxHp=500;
                entity.hp=500;
                teem_red.push(entity.player.name);
                entity.position.set(63, 14, 86);
                entity.player.spawnPoint.copy(entity.position);
            } else{
                entity.player.color.r=0;
                entity.player.color.g=0;
                entity.player.color.b=1;
                entity.maxHp=500;
                entity.hp=500;
                entity.position.set(喵, 15, 33);
                entity.player.spawnPoint.copy(entity.position);
                teem_blue.push(entity.player.name);
            }
        }
    }
});

 

懒得写了,直接复制粘贴

emotion_编程猫_冷漠

今天的代码你会了吗,为了工作是升级,给我个教程贴吧

emotion_雷电猴_围观emotion_雷电猴_围观emotion_雷电猴_围观emotion_雷电猴_围观emotion_雷电猴_围观

注:下期升级工作室教程贴内容

得分的统计

不要错过哦

升级工作室加油!!!

emotion_编程猫_加油emotion_编程猫_加油emotion_编程猫_加油emotion_编程猫_加油emotion_编程猫_加油emotion_编程猫_加油emotion_编程猫_加油

 


回复

上一页1 页 / 共 1下一页
datacatdatacat

哈哈,吉吉喵,官方们,给个教程吧

点赞0


评论


kkk_AC工作室toby小号kkk_AC工作室toby小号

emmm我们团队也行…

点赞0


评论


爱画画的牛爱画画的牛

d d

点赞0


评论


高贵的木叶龙A35d高贵的木叶龙A35d

6666666666emotion_编程猫_加油

点赞0


评论


高贵的木叶龙A35d高贵的木叶龙A35d

计分代码……我会

点赞0


评论


datacatdatacat

dd

点赞0


评论


编程猫编程猫

https://dwz.cn/fLjKArIK

点赞0


评论


datacatdatacat

啊啊啊

点赞0


评论


吃瓜群众吃瓜中吃瓜群众吃瓜中

var super_player_name=new Array();
//super_player_name.push('人工智能AI');
super_player_name.push('一个XXX');
super_player_name.push('代码岛3加油');
//super_player_name.push('GOLDEN_EXPERIENCE');
//super_player_name.push('长着利爪的小猫');
//super_player_name.push('谢谨鸿Rsne');
//super_player_name.push('谢谨鸿');

world.onPlayerJoin(({entity})=>{
    if(contains(super_player_name,entity.player.name)){
        entity.player.canFly=true;
        world.say('欢迎作者'+entity.player.name+'进入游戏!');
    }
    entity.player.directMessage(entity.player.name+',欢迎来到海上对决');
    if(contains(super_player_name,entity.player.name)){
         
    } else{
        if(teem_red.length!=teem_blue.length){
            if(teem_red.length<teem_blue.length){
                entity.player.color.r=1;
                entity.player.color.g=0;
                entity.player.color.b=0;
                entity.maxHp=500;
                entity.hp=500;
                teem_red.push(entity.player.name);
                entity.position.set(63, 14, 86);
                entity.player.spawnPoint.copy(entity.position);
            } else{
                entity.player.color.r=0;
                entity.player.color.g=0;
                entity.player.color.b=1;
                entity.maxHp=500;
                entity.hp=500;
                entity.position.set(64, 15, 33);
                entity.player.spawnPoint.copy(entity.position);
                teem_blue.push(entity.player.name);
            }
        } else{
            if(Math.round(Math.random())===1){
                entity.player.color.r=1;
                entity.player.color.g=0;
                entity.player.color.b=0;
                entity.maxHp=500;
                entity.hp=500;
                teem_red.push(entity.player.name);
                entity.position.set(63, 14, 86);
                entity.player.spawnPoint.copy(entity.position);
            } else{
                entity.player.color.r=0;
                entity.player.color.g=0;
                entity.player.color.b=1;
                entity.maxHp=500;
                entity.hp=500;
                entity.position.set(64, 15, 33);
                entity.player.spawnPoint.copy(entity.position);
                teem_blue.push(entity.player.name);

点赞0


评论


吃瓜群众吃瓜中吃瓜群众吃瓜中

厉害了

点赞0


评论


BZS编程球球BZS编程球球

哇哦

点赞0


评论


datacatdatacat

dd

点赞0


评论


神龙_build神龙_build

ooo

点赞0


评论


_F_S_2__F_S_2_

没有用诶

 

点赞0


评论


凌_墨水凌_墨水

我差个颜色的

点赞0


评论


TobylaiTobylai

旋转实体谁会...

路人和我只会一点点...

点赞0


评论


高贵的木叶龙A35d高贵的木叶龙A35d

完整代码不给,我就不信你能加精

点赞0


评论


两个小八路两个小八路

emotion_编程猫_加油

点赞0


评论


Ken李Ken李

哇哦

点赞0


评论


Chara_juechuief_sChara_juechuief_s

666编程猫官方,你们真的应该多一点代码啊!不然每次打代码的时候都不知道。哎。。。emotion_编程猫_伤心

点赞0


评论


波仔看世界波仔看世界

emotion_编程猫_点赞

点赞0


评论


TobylaiTobylai

数组.push()

类似python的列表.append()

都是在末尾添加内容

点赞0


评论


datacatdatacat

dd

点赞0


评论


ssssSSSAssssSSSA

cy

点赞0


评论


ssssSSSAssssSSSA

wowo

点赞0


评论


USS米奈希尔之怒USS米奈希尔之怒

有颜色还原的代码吗。。

点赞0


评论