猫史档案馆


die码求助

用户:灵清帝王吃爆一切厕所灵清帝王吃爆一切厕所查看:103 回复:3 评论:10 创建时间:2022-04-12T17:18:48


world.querySelectorAll('#蓝色球').forEach(async( mesh ) => {
        mesh.enableInteract = true;
        mesh.interactHint = '冰球';
        mesh.interactRadius = 2;
        mesh.interactColor.set(0, 0, 1);
        mesh.onInteract(async({ entity }) => {
            if(entity.hasTag('blue')) {
                entity.blue_ball += 1
                entity.player.directMessage(`您已捡到${entity.blue_ball}个球`)
            } else{
                entity.player.directMessage('这不是火人捡的球哦!这是冰人捡的球!')
            }
        })
    })
    world.querySelectorAll('#红球').forEach(async( mesh ) => {
        mesh.enableInteract = true;
        mesh.interactHint = '火球';
        mesh.interactRadius = 2;
        mesh.interactColor.set(1, 0, 0);
        mesh.onInteract(async({ entity }) => {
            if(entity.hasTag('red')) {
                entity.red_ball += 1;
                entity.player.directMessage(`您已捡到${entity.red_ball}个火球`);
            }else{
                entity.player.directMessage('这不是冰人捡的球哦!这是火人捡的球!')
            }
        })
    })

BUG是明明捡一次球就会显示+2颗球,这是为啥啊??????????????


回复

上一页第 1 页 / 共 1 页下一页
loc浪迹天涯loc浪迹天涯

world.querySelectorAll('#蓝色球').forEach(async( mesh ) => {
        mesh.enableInteract = true;
        mesh.interactHint = '冰球';
        mesh.interactRadius = 2;
        mesh.interactColor.set(0, 0, 1);
        mesh.onInteract(async({ entity ,other}) => {
            if(entity.hasTag('blue')) {
                entity.blue_ball += 1
                other.destroy()
                entity.player.directMessage(`您已捡到${entity.blue_ball}个球`)
            } else{
                entity.player.directMessage('这不是火人捡的球哦!这是冰人捡的球!')
            }
        })
    })
    world.querySelectorAll('#红球').forEach(async( mesh ) => {
        mesh.enableInteract = true;
        mesh.interactHint = '火球';
        mesh.interactRadius = 2;
        mesh.interactColor.set(1, 0, 0);
        mesh.onInteract(async({ entity ,other}) => {
            if(entity.hasTag('red')) {
                entity.red_ball += 1;
                other.destroy()
                entity.player.directMessage(`您已捡到${entity.red_ball}个火球`);
            }else{
                entity.player.directMessage('这不是冰人捡的球哦!这是火人捡的球!')
            }
        })
    })

点赞0


评论

我改了改,你看看行不行,一剑

不行()还是会一次加2个。。。

那是哪里的问题?

我已经找出来了!我傻乎乎的把交互代码放在了world.onPlayerJoin这个函数里面,当然会报错——

az,那就不关我的事了,你没在帖子里写Join


guxia666guxia666

az

点赞0


评论


guxia666guxia666

给我链接我帮你改(bushi)

你这代码有大大大问题

点赞1


评论

已经没问题了啊()

哦哦哦,那就没事了

你真的以后不会再回来了吗?…………………………

偶尔回来看看也好啊…………

额,上高中后