猫史档案馆


简易 pvp

用户:望雪墨球望雪墨球查看:0 回复:3 评论:0 创建时间:2020-05-23T18:52:44


//一个简单的射击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();
});

 


回复

上一页1 页 / 共 1下一页
Lonely_wandererLonely_wanderer

API有

点赞0


评论


叹记叹记

额 

点赞0


评论


J_K_Hermione_build白泽J_K_Hermione_build白泽

可以用吗

点赞0


评论