用户:指令者查看:20 回复:5 评论:20 创建时间:2021-02-27T20:29:38
如题,试了好多方法都不行
治愈绾兮world.onPlayerJoin(({ entity }) => {
entity.player.onPress(({ button, raycast: { hitEntity, direction, distance } }) => {
if (button !== 'action0' || !hitEntity ||distance > 8) {
return;
}
hitEntity.velocity.x += direction.x;
hitEntity.velocity.y += 0.5;
hitEntity.velocity.z += direction.z;
hitEntity.hurt(20, {
attacker: entity,
});
});
});点赞0
评论
world.onClick(({ entity, clicker, distance }) => {
if (distance>5){//判断距离是否大于5(5可以改成任何数)
return;
}
if (entity.isPlayer) {
world.say(`${clicker.player.name} 击中 ${entity.player.name}`)
} else {
world.say(distance)
world.say(`${clicker.player.name} 击中 ${entity.id}`)
}
entity.hurt(20)
if(entity.hp<=0){
world.say(`${entity.id} 被 ${clicker.player.name}送去见喵`)
entity.destroy()
}
点赞0
评论