用户:
腾讯内部员工查看:7 回复:6 评论:7 创建时间:2020-04-19T15:14:06
吧
月战老兵//一个简单的射击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 + ' 击杀 ' + entity.player.name+'为他报仇')
}
entity.player.forceRespawn();
});点赞0
评论