用户:
BSS梅者如西查看:10 回复:2 评论:10 创建时间:2020-05-04T16:48:58
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;
if(!hitEntity.isPlayer){return}
hitEntity.hurt(5 * Math.random() + 5, {
attacker: entity,
});
});
});
//检测攻击代码
world.onDie(({ entity, attacker }) => {
if (attacker) {
world.say(attacker.player.name + ' 击杀了 ' + entity.player.name)
}
entity.player.forceRespawn();
});//喵亡后代码