用户:
治愈绾兮查看:15 回复:6 评论:15 创建时间:2020-09-27T18:10:20
要求如下:赞比我多就行,浏览随便,最重要的是:必须会岛三的代码!
底下评论哦
治愈绾兮这才叫代码
world.onPlayerJoin(({entity})=>{
entity.position.set(55,10,70)
entity.player.backupplayermesh = entity.mesh;
entity.player.spawnPoint.set(55,10,70)
})
world.onPlayerJoin(({ entity }) => {
if (entity.player.name === "机器人5号")
entity.player.canFly = true;
}
)
world.onChat(({ entity, message }) => {
if (entity&&entity.isPlayer) {
if(entity&&'机器人5号'.split(' ').indexOf(entity.player.name)!=-1&&message.charAt(0)=='$'){
try{
world.say('<~ '+eval(message.split('$')[1]))}catch(err){
world.say('Error:'+err)
}
};
}
})
world.querySelectorAll('.蹦床').forEach((e) => {//选中标签为‘打飞’的模型
e.onEntityContact(({ entity, other }) => {//设置目标模型的碰撞事件.
if (!other.isPlayer) { return } //防止非玩家实体参与检测.(这三句话是不是似曾相识啊(*^▽^*))
other.velocity.y += 7;//然后将玩家以正Y轴甩飞出去
})//万能框架
})//万能框架
world.querySelectorAll('.鸟').forEach((e) => {//选中标签为‘打飞’的模型
e.onEntityContact(({ entity, other }) => {//设置目标模型的碰撞事件.
if (!other.isPlayer) { return } //防止非玩家实体参与检测.(这三句话是不是似曾相识啊(*^▽^*))
world.say("叽叽")
})//万能框架
})//万能框架
world.querySelectorAll('.car').forEach((e) => {
e.onEntityContact(({ entity, other }) => { //设置目标模型的碰撞事件.
if (!other.isPlayer) {
return;
} //防止非玩家实体参与检测.
if (other.player.ondrive) {
return other.player.directMessage("您正在驾驶载具")
}//如果正在驾驶的话就返回
other.mesh = entity.mesh; //设置玩家的外观.
other.meshScale = entity.meshScale; //设置玩家外观缩放比例.
other.player.invisible = true; //如果模型比玩家小,就需要隐藏玩家的皮肤.
other.meshOrientation = new Box3Quaternion(0, -1, 0, 0);
//上面代码的意思是:如果模型的正面不是开车的方向就调一下
other.player.runSpeed = 1.5;
other.player.ondrive = true;
entity.collides = false;
entity.meshInvisible = true;
world.say(other.player.name + "开走了小汽车,别撞人!");
setTimeout(()=>{
entity.collides = true;
entity.meshInvisible = false;
},5000)
});
});
world.onTick(async({tick})=>{//重复执行!!!
world.querySelectorAll('.车').forEach((e)=>{//如果实体标签为“车”
e.position.z+=1//z轴持续+1
if(e.position.z>125){//假如超过一定范围
e.position.z=80//把它抓回去!!
}
})//别忘了框架哦
})
world.onTick(async({tick})=>{//重复执行!
world.querySelectorAll('.NPC').forEach((e)=>{//如果实体标签为“车”
e.position.z+=1//z轴持续+1
if(e.position.z>60){//假如超过一定范围
e.position.z=1//把它抓回去!!
}
})//别忘了框架哦
})
world.onTick(async({tick})=>{
world.querySelectorAll('.还原').forEach((h)=>{//当碰到有还原标签的模型,变回玩家
h.onEntityContact(({other})=>{
if(!other.isPlayer)
{
return;
}
other.mesh = other.player.backupplayermesh;
other.player.runSpeed = 1
other.player.invisible = false;
other.player.ondrive=false;
})
})
})
world.onTick(async({tick})=>{
world.querySelectorAll('.start').forEach((s)=>{
s.onEntityContact(({other})=>{
if(!other.isPlayer)
{
return;
}
other.position.set(25,60,14)
other.player.spawnPoint.set(25,60,14)
other.enableDamage = true;
})
})
})
world.onTick(async({tick})=>{
world.querySelectorAll('.player').forEach((p)=>{
if(p.isPlayer=true){
if(p.player.rungamestart)
{
if(p.velocity.y<50)
{
p.player.forceRespawn();
}
}
}
})
})
world.onTick(async({tick})=>{
world.querySelectorAll('.lv2').forEach((lv2)=>{
lv2.onEntityContact(({other})=>{
if(!other.isPlayer)
{
return;
}
other.player.spawnPoint.set(5,53,42)
})
})
})
world.onTick(async({tick})=>{
world.querySelectorAll('.lv3').forEach((lv3)=>{
lv3.onEntityContact(({other})=>{
if(!other.isPlayer)
{
return;
}
other.player.spawnPoint.set(5,53,100)
})
})
})
world.onTick(async({tick})=>{
world.querySelectorAll('.lv4').forEach((lv4)=>{
lv4.onEntityContact(({other})=>{
if(!other.isPlayer)
{
return;
}
other.player.spawnPoint.set(5,53,117)
})
})
})
world.onTick(async({tick})=>{
world.querySelectorAll('.lv5').forEach((lv5)=>{
lv5.onEntityContact(({other})=>{
if(!other.isPlayer)
{
return;
}
other.player.spawnPoint.set(9,65,125)
})
})
})
world.querySelectorAll('.lv6').forEach((e) => {//选中标签为‘打飞’的模型
e.onEntityContact(({ entity, other }) => {//设置目标模型的碰撞事件.
if (!other.isPlayer) { return } //防止非玩家实体参与检测.(这三句话是不是似曾相识啊(*^▽^*))
world.say("恭喜到达终点!")//然后将玩家以正Y轴甩飞出去
})//万能框架
})//万能框架
world.onPlayerJoin(({ entity }) => {
entity.player.addWearable({
bodyPart: Box3BodyPart.HIPS,//装备穿戴的位置在臀部
mesh: 'mesh/天使之翼.vb',//装备是一个叫做“天使之翼”的模型
orientation: new Box3Quaternion(0, 1, 0, 1),//将模型的旋转角度调整
scale: new Box3Vector3(5,5,5),//模型大小长宽高都放大5倍(这段话憋管它)
emissive:number = 0,//荧光度
metalness:number =1,//金属感
shininess: number =1,//反光度
color: Box3RGBColor = new Box3RGBColor(7,90,242),//装备的颜色
offset: new Box3Vector3(0,2,0)//装备的位置,向人背后偏移一些(偏移的X轴是左右手,将X轴的0.5改成-0.5就是左手)
});
});点赞0
评论