用户:
0ttB查看:0 回复:1 评论:0 创建时间:2021-02-20T15:03:01
发布自己的作品。。。
小鸡
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,//受重力下落
feiction:0.45,//摩擦力0.45
meshScale:DefaultScale,//模型放大倍数
position:[x,y,z],//位置坐标
})
entity.enableDamage = true
entity.onVoxelContact(({x,y,z,voxel})=>{
entity.velocity.x = (Math.random()-0.5)*0.5
entity.velocity.y = 0.5 + Math.random()*0.5
entity.velocity.z = (Math.random()-0.5)*0.5
if(voxel != voxels.id('stone')){
voxels.setVoxel(x,y,z,'')
}
if(voxel === voxels.id('red_light')){
other.hurt(15)
}
})
entity.onEntityContact(({other})=>{
if(other.isPlayer){
other.hurt(5)
}
})
entity.onDie(()=>{
entity.destroy('mesh/公鸡.vb')
})
return entity
}
world.onPlayerJoin(({entity})=>{
entity.enableDamage = true
entity.onVoxelSeparate(({x,y,z,voxel})=>{
voxels.setVoxel(x,y+1,z,'red_light')
})
})
for(var i=0;i<250;i++){
spawn(喵,i+10,63,'mesh/公鸡.vb')
}点赞0
评论