猫史档案馆


帝王气息大佬

帝王气息大佬

Lv.1

噢噢噢哦哦噢噢噢哦哦我是大佬嘿嘿

获赞:8收藏:0浏览:8作品收藏:0
回复帖子评论
上一页2 页 / 共 2下一页

求代码!!!急 中回复

然后伤害也可以杀一只僵尸增加一点,死掉恢复成10伤害

2020-08-25T10:23:51 点赞:0

求代码!!!急 中回复

我喵

2020-08-25T10:28:53 点赞:0

【源码精灵】曝光精灵--我太穷了 中回复

看来是的,不过巴巴我喜欢

2020-08-25T10:32:08 点赞:0

求代码!!!急 中回复

呜呜呜有人吗

2020-08-25T15:39:21 点赞:0

求代码!!!急 中回复

2020-08-25T17:13:59 点赞:0

【水】改楼下的名字 中回复

发是对v是v是

2020-08-25T17:20:47 点赞:0

【水】用一句话谦虚的说出你家很富 中回复

what,刚刚又多了几百亿?烧了

2020-08-25T17:23:28 点赞:0

help!!! 中回复

dd

2020-08-25T17:24:28 点赞:0

求代码!!!急 中回复

dd

2020-08-25T17:24:39 点赞:0

求代码!!!急 中回复

2020-08-26T11:33:12 点赞:0

求代码!!!急 中回复

呃呃没人帮我呜呜呜

2020-08-26T12:18:10 点赞:0

求代码!!!急 中回复

dd

2020-08-26T19:41:04 点赞:0

【小游戏】在键盘上随便打会怎么样? 中回复

额好看完全康复我吧我会帮我鳄梨别逼我阿u

2020-08-27T09:42:22 点赞:0

求代码!!!急 中回复

d d

2020-08-28T21:16:35 点赞:0

【关于本号 中回复

。。。

2020-09-10T19:40:37 点赞:0

【关于本号 中回复

sofa

2020-09-10T19:40:44 点赞:0

【关于本号 中回复

用错号了

2020-09-10T19:40:53 点赞:0

谁能帮我解释下 中回复

//希望僵尸可以被打完后说人类胜利并重新生成

const MeshScale = [0.0625,0.0625,0.0625]
function spawn() {
const e = world.createEntity({
mesh:'mesh/僵尸.vb',
meshScale:MeshScale,
collides:true,
gravity:true,
friction:0,
maxHp:20,
hp:20,
position:[
喵+(Math.random()-0.5) * 60,
24 + Math.random() * 50,
喵+(Math.random()-0.5) * 60,
],
meshColor: new Box3RGBAColor(0,255,0,255),
meshEmissive:20,
});
e.a喵Tag('僵尸');
e.enableDamage = true;
e.onVoxelContact(({x,y,z,voxel})=>{
e.velocity.y = 0.9+Math.random()*0.3
})
e.onEntityContact(({other})=>{
if(other.isPlayer){
other.hurt(10)
}
})
e.onDie(()=>{
world.say('又击杀了1只僵尸')
e.destroy()
function resolveAfter5Seconds() {
return new Promise(resolve => {
setTimeout(() => {
resolve('resolved');
}, 10000);
});
}

spawn()//重新生成一只僵尸,防止僵尸被杀完.
})
}
//随机僵尸
function mathRandomInt(a, b) {
if (a > b) {
var c = a;
a = b;
b = c;
}
return Math.floor(Math.random() * (b - a + 1) + a);
}

for (let i = 0; i < mathRandomInt(100, 300); i++) {
spawn()
}
const Quat = new Box3Quaternion(0,0,0,1)
let allPlayers = []
let allZombies = []
world.onTick(({tick}) => {
if(tick%16===0){
allPlayers = world.querySelectorAll('player')
allZombies = world.querySelectorAll('.僵尸')
}
allZombies.forEach((e) => {
let zomPos = e.position
if(tick%11===0){
let target = allPlayers.sort((a,b)=>{
return a.position.distance(zomPos)-b.position.distance(zomPos)
})[0]
if(target){
e.target = target
}
}
if(e.target && !e.target.destroyed){
var direction = e.target.position.sub(zomPos);
var dist = direction.mag()
var speed = 0.2+Math.random()*0.3
e.velocity.x = direction.x*speed/dist
e.velocity.z = direction.z*speed/dist
var orientation = Quat.rotateY(Math.atan2(e.velocity.z, e.velocity.x))
e.meshOrientation.copy(orientation)
}
})
})
world.onClick(({entity})=>{
if (entity.hasTag('僵尸')) {
entity.hurt(10)
} else {
if (entity.isPlayer) {//帮其他玩家回血
if (!entity.hp===entity.maxHp) {
entity.hp+=entity.maxHp/5
} else {
entity.hp=entity.maxHp
}
}
}
})
world.onChat(async ({entity,message})=>{
if (message==='回血') {
entity.hp=entity.hp+20
world.say(`${entity.player.name}回血了。`)
} else if (message==='/help') {
world.say('点击其他玩家可以帮ta回至少一半的血量\n点击僵尸可以把僵尸kill掉\n加油~')
}
})

world.onPlayerJoin(({entity})=>{
entity.player.scale=0.3
entity.enableDamage = true;
entity.onDie(async()=>{
world.say(`⚠${entity.player.name} 被袭击身亡, 5秒后复活⚠`)
await sleep(5000)
entity.position.x = Math.random()*127
entity.position.z = Math.random()*127
entity.position.y = 100
await sleep(100)
entity.hp = entity.maxHp
})
})

谁帮一下

2021-02-13T22:00:51 点赞:0

谁能帮我解释下 中回复

2021-02-14T10:47:07 点赞:0