
Lv.1
QAQ
签名:隐
在 pvp代码:这里有 中回复
//一个简单的射击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(2 * Math.random() + 1, {
attacker: entity,
});
});
});
world.onDie(({ entity, attacker }) => {
if (attacker) {
world.say(attacker.player.name + ' killed ' + entity.player.name)
}
entity.player.forceRespawn();
});
undefined;2020-06-27T11:02:01 点赞:0
在 【墨教】还在模型存档点?方块存档点爽到飞!! 中回复
world.onVoxelContact(({ voxel, entity }) => {//设置碰撞事件
const block = voxels.id('S');//设置碰撞对象ID为'S'(即spawnpoint),触发(方块ID可改),给碰撞对象取名字为block(方块)
if (voxel === block) {//如果碰撞了
entity.player.directMessage('存档成功!');//私信玩家‘存档成功’
entity.player.spawnPoint = new Box3Vector3(entity.position.x,entity.position.y,entity.position.z);//玩家重生点为x66y66z66(数值可改)
}//万能框架
})//万能框架
world.onVoxelContact(({ voxel, entity }) => {
const block = voxels.id('Z');//这个方块是终点方块
if (voxel === block) {//假如跑酷到了终点
world.say("1人到达终点,获得飞行权限!")
entity.player.canFly = true;//你可以飞喽
}
})
2020-06-27T12:04:09 点赞:2