猫史档案馆


求代码!!

用户:月战老兵月战老兵查看:3 回复:6 评论:3 创建时间:2020-04-02T22:10:03


谁告诉我PVP的代码,类似月球大战的那种emotion_编程猫_紧张


回复

上一页1 页 / 共 1下一页
月战老兵月战老兵

并且把我设置成可以创作的,空白地图可获得音乐大礼包

点赞0


评论


QBZ_QBZ_

额额

点赞0


评论


QBZ_QBZ_

去看官方文档啊

点赞1


评论


月战老兵月战老兵

打出来

点赞0


评论


cool-creepercool-creeper

docs.box3.codemao.cn

点赞0


评论


datacatdatacat

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


评论