Lv.1
今生无悔入mc,来世愿做方块人!
在 【求助】谁会攻击距离为8格的PVP代码 中回复
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()
}
2022-12-26T15:35:16 点赞:0
在 请教问题-距离判定 中回复
world.onClick(({ entity, clicker, distance }) => {
if (distance>10){//判断距离是否大于10(10可以改成任何数)
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}KO了!`)
entity.destroy()
}
2022-12-26T15:36:50 点赞:0
在 求助,怎么点击玩家之后如果他跟点击者的距离小于50,才能进行伤害 中回复
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()
}
2022-12-26T15:38:10 点赞:0