猫史档案馆


神奇代码岛3里怎么让玩家点击另一个玩家,让另一个玩家受到伤害的代码

用户:设置昵称在这里设置昵称在这里查看:1 回复:2 评论:1 创建时间:2022-02-09T11:53:36


求回复imgsrc="http://img.t喵t4/appstyle/expression/ext/normal/73/wq_thumb.gif"alt="emotion_委屈"


回复

上一页1 页 / 共 1下一页
超能枫叶超能枫叶

找吉吉喵去,上www.bilibili.com找教程!

点赞0


评论


该账号已停用该账号已停用

//转自API
  //一个简单的射击PvP
  world.onPlayerJoin(({ entity }) => {
    entity.enableDamage = true;
    entity.player.onPress(({ button, raycast:{ hitEntity, direction } }) => {
        if (button !== 'action0' || !hitEntity) {
            return;
        }
        hitEntity.velocity.x += direction.x;
        hitEntity.velocity.y += 0.5;
        hitEntity.velocity.z += direction.z;
        hitEntity.hurt(20 * Math.random() + 5, {
            attacker: entity,
        });
    });
});

world.onDie(({ entity, attacker }) => {
    if (attacker) {
        world.say(attacker.player.name + ' killed ' + entity.player.name)
    }
    entity.player.forceRespawn();
});

点赞0


评论