猫史档案馆


按左建让玩家减少5点血量的代码是什么啊!?

用户:千星河凉月吖千星河凉月吖查看:1 回复:2 评论:1 创建时间:2022-08-27T11:09:15


告诉我吧!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!


回复

上一页1 页 / 共 1下一页
mkonnzikmkonnzik

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


评论


Nobody_Nobody_

他甚至不愿意看api,我哭喵()

点赞1


评论