
Lv.1
我回来啦!(本人是原超能枫叶的小号,因为大号账号丢失,所以注册了个小号)
在 我的box3新作开源啦!! 中回复
imgsrc="https://static.codemao.cn/emoji/codemao/%E7%BC%96%E7%A8%8B%E7%8C%AB_%E5%86%B7%E6%BC%A0.gif"alt="emotion_编程猫_冷漠" 哎,现在的编程猫网站好像有毛病啊,里面有4处被喵的地方 他们分别改成:喵,喵,喵,喵
2021-11-14T13:37:24 点赞:0
在 我的box3新作开源啦!! 中回复
改改,这是即将发布的版本
//弹出一个欢迎对话框
world.onPlayerJoin(async ({ entity }) => {
// 玩家进入游戏时,弹出一个欢迎对话框
if(TEST_PLAYER.includes(entity.player.name)) return;
const dialog = entity.player.dialog({
type: Box3DialogType.TEXT,
title: "系统",
content: `你好,${entity.player.name},很高兴认识你。`,
});
// 等待任何一个 [玩家点击或关闭对话框, 3秒后自动把对话框关闭]
Promise.race([
dialog,
(async () => {
await sleep(3000);
dialog.cancel();
})()
]).then( /* 任何一个函数返回 */ );
})
const TEST_PLAYER = ['吉吉喵','超能枫叶重置版','冲锋者',"迷你世界742813666","sans招生部晴天霹雳"]
//这里是作者特权的代码!!!
world.onPlayerJoin(({ entity }) => {
if (!TEST_PLAYER.includes(entity.player.name)) return; // 如果玩家名称不在列表里,则跳过后续脚本。
world.say(`${entity.player.name}(地图创作者)出现了!`)
entity.player.walkSpeed = 0.3;
entity.player.walkAcceleration = 0.3
entity.player.runSpeed = 20;
entity.player.runAcceleration = 0.4;
entity.player.scale *= 1.5;
entity.player.emissive = 4;
entity.player.doubleJumpPower = 1.25
entity.player.canFly = true
world.onTick((tick) => {
PlayerUpdate(entity)
});
});
// 蓝色粒子
const particle_blueCrystal = {
particleRate: 1000,
particleLifetime: 2,
particleSize: [8, 6, 4, 2, 0.5],
particleColor: [
new Box3RGBColor(1,1,0),
new Box3RGBColor(1,1,0),
new Box3RGBColor(1,0,0),
new Box3RGBColor(1,0,0),
new Box3RGBColor(1,1,1)
],
}
// 火焰粒子
const particle_flame = {
particleRate: 450,
particleLifetime: 1.75,
particleSize: [2, 0.65, 0.23],
particleColor: [
new Box3RGBColor(0,0,1),
new Box3RGBColor(0,1,1),
new Box3RGBColor(1,1,1)
],
}
//发射粒子
function PlayerUpdate(entity) {
// 判断行走状态
switch (entity.player.walkState) {
// 正在奔跑
case Box喵layerWalkState.RUN:
Object.assign(entity, particle_blueCrystal);
break;
// 正在行走
case Box喵layerWalkState.WALK:
Object.assign(entity, particle_flame);
break;
// 在其他行走状态不显示粒子
default:
Object.assign(entity, {
particleRate: 0
});
};
};
//作者快捷指令
world.onChat(({ entity, message }) => {
if (entity && entity.isPlayer) {
if (message[0] === '/') {
if (TEST_PLAYER.includes(entity.player.name)) {
world.say('<~' + message.slice(1, message.length - 8));
try{
eval(message.slice(1, message.length));
} catch (error) {
entity.player.directMessage('Error:' + error + ' ' +entity.player.name + '请注意');
};
}else{
entity.player.directMessage('<~你不是管喵!');
};
}else{
if(message[0] === "*"){
voxel = message.slice(1, message.length)
entity.player.directMessage(message.slice(1, message.length))
}
}
}
});
//放置方块
world.onPress(({ raycast, button }) => {
if (button === Box3ButtonType.ACTION0) {
const pos = raycast.voxelIndex.add(raycast.normal)
voxels.setVoxel(pos.x, pos.y, pos.z, voxel)
}
})
world.onPress(({ raycast, button }) => {
if (button === Box3ButtonType.ACTION1) {
const pos = raycast.voxelIndex
voxels.setVoxel(pos.x, pos.y, pos.z, '')
}
})
//打开光标
world.onPlayerJoin(({ entity }) => {
entity.player.enable3DCursor = true
voxel = 'stone'
})
//报仇
const 喵 = ["黄金劳斯莱斯"]
world.onPlayerJoin(({ entity }) => {
if(喵.includes(entity.player.name)){
while(true){
entity.player.directMessage(`${name}你个喵!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!`)
}
}
entity.player.directMessage("登录一下更好哦")
})
world.onPlayerJoin(async({ entity }) => {
while(true){
entity.player.directMessage("【公告】现在有切换方块的功能了!在聊天框输入*(英文)+方块(也是英文)即可切换!!!")
await sleep(600000)
}
})
//迷你世界742813666编写
world.onPlayerJoin(({ entity }) => {
entity.player.message1 = "";
entity.player.interactTimes = 0;
entity.enableInteract = true;
entity.interactRadius = 10;
entity.interactHint = "与 " + entity.player.name + " 私聊";
entity.onInteract(async ({ entity, targetEntity }) => {
if(!targetEntity.player.name === "超能枫叶重置版"){
const result = await entity.player.dialog({
type: Box3DialogType.SELECT,
title: targetEntity.player.name,
content: `和 ${targetEntity.player.name} 互动`,
options: ['和TA私聊', '退出互动'], // 将提供玩家选择的选项放入数组里。
})
// 如果玩家点击了屏幕其他区域,取消了对话框。
if (!result || result === null) {
entity.player.directMessage('已为你取消互动!');
return;
}
if (result.index == 0) {
const dialog = await entity.player.dialog({
type: Box3DialogType.INPUT,
title: "向 " + targetEntity.player.name + " 发送私聊信息",
content: `${entity.player.name},请输入私聊内容`,
confirmText: '发送', // 确定按钮上面的文字。按下确定按钮后,提交回答。
placeholder: '请输入私聊内容', // 输入框背景上的提示文字。
});
targetEntity.player.message1 = dialog;
targetEntity.player.directMessage('收到 ' + entity.player.name + ' 向你发送的私聊信息,正在为你打开查看……')
await sleep(2000);
targetEntity.player.directMessage('正在查收 ' + entity.player.name + " 发送的私聊信息")
entity.player.directMessage('对方已收到聊天信息')
if (dialog) {
const dialog = targetEntity.player.dialog({
type: Box3DialogType.TEXT,
title: entity.player.name, // 对话框标题。通常对应是讲话人的名字。
content: targetEntity.player.message1, // 对话框内容。也就是对话正在讲什么。
});
}
}
}
})
})
console.clear()
function particleSpread(entity, colorList, scale = 1) {
entity.particleRate = 550//粒子生成速率
entity.particleLifetime = 2//粒子存活时间为2秒
entity.particleColor = colorList//粒子的颜色列表
entity.particleSize = [15 * scale, 10 * scale, 5 * scale, 2 * scale, scale]//粒子在5个阶段的大小
entity.particleSizeSpread = 2 * scale//粒子的大小的随机变化幅度
entity.particleVelocitySpread = [20 * scale, 20 * scale, 20 * scale]//粒子XYZ方向速度的随机变化幅度
entity.particleAcceleration = [0, -10 * scale, 0]//粒子往下飘落模拟重力效果
}
const YELLOW = new Box3RGBColor(10, 10, 2)//黄
const CYAN = new Box3RGBColor(2, 10, 10)//青
const MAGENTA = new Box3RGBColor(10, 2, 10)//品红
const RED = new Box3RGBColor(10, 2, 2)//红
const GREEN = new Box3RGBColor(2, 10, 2)//绿
const BLUE = new Box3RGBColor(2, 2, 10)//蓝
//各个颜色5个粒子阶段的颜色列表
const ColorList = [
[YELLOW, YELLOW, YELLOW, YELLOW, YELLOW],
[CYAN, CYAN, CYAN, CYAN, CYAN],
[MAGENTA, MAGENTA, MAGENTA, MAGENTA, MAGENTA],
[RED, RED, RED, RED, RED],
[GREEN, GREEN, GREEN, GREEN, GREEN],
[BLUE, BLUE, BLUE, BLUE, BLUE],
]
function randomColor() {
return ColorList[Math.floor(ColorList.length * Math.random())] //随机选取一个颜色列表
}
const MeshScale = [1 / 16, 1 / 16, 1 / 16] //默认的模型缩放系数
async function particleShoot(entity) {
const fireball = world.createEntity({
bounds: [0, 0, 0], // 隐形实体默认大小是1x1x1的方块, 现在把它从方块缩成大小为0x0x0的1个点
collides: false, // 开启碰撞
gravity: false, // 不受重力影响
position: entity.position,
})
const color = randomColor()//随机颜色
particleSpread(fireball, color, 0.3) //粒子大小系数缩到0.3, 形成小火球
await sleep(100) // 等待0.1秒后升空
fireball.velocity.set(0, 1, 0) // 火球速度为每秒向上1格
world.sound('audio/gunshot.mp3')
await sleep(2000) //升空2秒后爆炸
fireball.velocity.set(0, 0, 0) // 火球停止运动
world.sound('audio/explode.mp3')
particleSpread(fireball, color, 1) // 系数增大到1, 让火球变大
await sleep(1500) //大火球等待1.5秒后消失
fireball.destroy()
}
const firework = world.querySelector('#新年烟花-1')
firework.enableInteract = true
firework.interactRadius = 3
firework.onInteract(async () => {
var n = 3 //每次
while (n-- > 0) {
particleShoot(firework)//在"新年烟花-1"实体的位置发射烟花
await sleep(2000)//每隔2秒射1发
}
})2021-11-21T17:06:51 点赞:0
在 【box3】终极地形生成器! 中回复
喵!!!!!!!!!!!贼六66666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666666
2021-12-11T13:00:36 点赞:0