用户:
霸道的疾风雀3KNp查看:3 回复:4 评论:3 创建时间:2021-02-11T22:19:57
兄弟们,帮我看看哪错了
const DefaultScale = [0.0625,0.0625,0.0625]
function spawn (x,y,z,meshName){
var entity = world.createEntity({
mesh:meshName,
collides:true,
fixed:false,
gravity:true,
friction:0.5,
meshScale:DefaultScale,
position:[x,y,z],
});
entity.onVoxelContact(({x,y,z,voxe1})=>{
entity.velocity.y = 0.5 + Math.random()*0.5
entity.velocity.x = (Math.random - 0.5)*0.5
entity.velocity.z = (Math.random - 0.5)*0.5
if(vosel == voxels.id('stone')){
}
else{
voxels.setVoxel(x,y,z,'')
}
})
return entity
}
for(var i=0;i<250;i++){
spawn (63,11+i,63,'mesh/公鸡.vb')
}改成这样:
const DefaultScale = [0.0625,0.0625,0.0625]
function spawn (x,y,z,meshName){
var entity = world.createEntity({
mesh:meshName,
collides:true,
fixed:false,
gravity:true,
friction:0.5,
meshScale:DefaultScale,
position:[x,y,z],
});
entity.onVoxelContact(({x,y,z,voxel})=>{
entity.velocity.y = 0.5 + Math.random()*0.5
entity.velocity.x = (Math.random - 0.5)*0.5
entity.velocity.z = (Math.random - 0.5)*0.5
if(vosel == voxels.id('stone')){
}
else{
voxels.setVoxel(x,y,z,'')
}
})
return entity
}
for(var i=0;i<250;i++){
spawn (63,11+i,63,'mesh/公鸡.vb')
}点赞0
评论
卫道士32_32*2没了const DefaultScale = [0.0625,0.0625,0.0625];
function spawn (x,y,z,meshName){
var entity = world.createEntity({
mesh:meshName,
collides:true,
fixed:false,
gravity:true,
friction:0.5,
meshScale:DefaultScale,
position:[x,y,z],
});
entity.onVoxelContact(({x,y,z,voxel})=>{
entity.velocity.y = 0.5 + Math.random()*0.5
entity.velocity.x = (Math.random - 0.5)*0.5
entity.velocity.z = (Math.random - 0.5)*0.5
if(voxel!=voxels.id('stone')){
voxels.setVoxel(x,y,z,0)
}
})
return entity;
}
for(var i=0;i<250;i++){
spawn(63,11+i,63,'mesh/公鸡.vb');
}点赞0
评论
还有这里哪错了?
world.onPlayerJoin(({ entity }) => {
entity.junk = 0
entity.money = 0
entity.itemList = []
entity.player.onPress(({ button }) => {
if (button == Box3ButtonType.ACTION1){
textDialog(entity, `你身上有:\n\n${entity.money}元,${entity.junk}个废品\n道具:[${entity.itemList}]`)
}
})
})
for (const e of world.querySelectorAll('.瓶盖垃圾,.空瓶垃圾')) {
e.enableInteract = true
e.interactRadius = 2
e.interactHint = e.tags()
e.interactColor.set(0,1,0)
e.onInteract(({ entity }) => {
entity.junk += 1
e.destroy()
entity.player.directMessage(`${entity.player.name}累积捡到${entity.junk}个废品`)
})
}
function textDialog(entity,content,title) {
return entity.player.dialog({
type:Box3DlalogTybe.TEXT,
content,
title,
})
}
点赞0
评论