猫史档案馆


BSS巴塞罗那足球俱乐部

BSS巴塞罗那足球俱乐部

Lv.1

获赞:0收藏:0浏览:0作品收藏:0
回复帖子评论
上一页1 页 / 共 1下一页

pvp代码:这里有 中回复

//一个简单的射击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(2 * Math.random() + 1, {
attacker: entity,
});
});
});

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

2020-05-02T16:16:42 点赞:0