猫史档案馆


Architect_皮卡awa

Architect_皮卡awa

Lv.1

我披星斩月 我奋不顾身 只为证明 你是个托(

获赞:149收藏:27浏览:1572作品收藏:9
回复帖子评论
上一页14 页 / 共 62下一页

问题!无法进入 中回复

emotion_doge

2020-08-14T19:36:19 点赞:0

【box3】方块动力(滑稽) 中回复

emotion_编程猫_厉害了

2020-08-14T20:01:11 点赞:0

出租广告位啦 中回复

emotion_编程猫_翻白眼

2020-08-15T14:32:52 点赞:0

喵的毁图者!!! 中回复

emotion_编程猫_厉害了emotion_doge

2020-08-15T18:02:13 点赞:0

[干货分享]如何让管喵在聊天栏中执行代码 中回复

顶顶顶顶顶顶顶顶顶顶顶顶顶顶顶emotion_doge

2020-08-15T20:17:03 点赞:0

[退猫贴]喵啊 中回复

emotion_编程猫_紧张emotion_编程猫_伤心

2020-08-18T07:59:21 点赞:0

[退猫贴]喵啊 中回复

我™退猫两天,昨天晚上才回来。你今天就给我走了.................

呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜呜

mx!你给我回来!!!!!!!!!!!!!!emotion_编程猫_伤心

2020-08-18T08:01:02 点赞:0

【代码岛教程贴】玩家发送指令并让系统自己恢复 中回复

...........

你头像貌似...........

和一位大佬一样,这样别人会认错的!

为了避免麻烦!

请更改会你原本的头像!!!emotion_怒

2020-08-18T08:04:08 点赞:2

【代码岛3.0活动预告】大神在线写代码!今天! 中回复

emotion_编程猫_点赞emotion_编程猫_厉害了

2020-08-18T08:06:04 点赞:0

【举报】CM一天中午 中回复

对我来说,我可以选择不管这件事情

因为,这位兄嘚,你举报了我@CM一天中午!!!

并且,举报貌似并没有成功!

而这一次,你必须把头像改回来,

因为这样搞头像的办法已经有帖子了,这并不能表明你真的会!

2020-08-18T08:09:29 点赞:1

【举报】CM一天中午 中回复

emotion_编程猫_溜了溜了请自觉!!!!

2020-08-18T08:16:19 点赞:0

【哇哇哇我找到阿尔法完整的露脸了】快来看看 中回复

h ttp://v.喵s/videoplus/362593738

2020-08-18T08:45:11 点赞:0

【代码岛3.0活动预告】大神在线写代码!今天! 中回复

emotion_编程猫_点赞

2020-08-18T08:48:51 点赞:0

【box3】岛三崩溃? 中回复

emotion_编程猫_翻白眼

2020-08-18T08:49:27 点赞:0

听说月球大战要下首页了???!?! 中回复

...............

被炸了??????????????emotion_编程猫_翻白眼

2020-08-18T08:52:27 点赞:0

听说月球大战要下首页了???!?! 中回复

emotion_编程猫_冷漠

2020-08-18T08:53:27 点赞:0

代码岛(box3.0)今天怎么这么卡? 中回复

emotion_编程猫_点赞

2020-08-18T09:25:57 点赞:0

【代码岛3.0活动预告】大神在线写代码!今天! 中回复

啊!岛3崩了emotion_编程猫_伤心

2020-08-18T11:19:50 点赞:0

【假墨水】被我逮着了!!把他封了!! 中回复

emotion_编程猫_紧张

2020-08-18T11:41:37 点赞:0

【代码岛3.0活动预告】大神在线写代码!今天! 中回复

emotion_编程猫_厉害了

2020-08-18T13:48:36 点赞:0

【找人】box3找人 会建跑酷的来 中回复

https://box3create.codemao.cn/games/f4d46b83577c5d696113

2020-08-18T18:37:11 点赞:0

【代码岛3.0代码公布!】僵尸追杀玩家 中回复

emotion_编程猫_点赞

2020-08-18T19:15:21 点赞:0

【代码岛3.0代码公布!】僵尸追杀玩家 中回复

emotion_鼓掌

2020-08-18T19:16:20 点赞:0

【代码岛3.0代码公布!】僵尸追杀玩家 中回复

6楼

2020-08-18T19:16:30 点赞:0

【代码岛3.0代码公布!】僵尸追杀玩家 中回复

7楼

2020-08-18T19:16:36 点赞:0

【代码岛3.0代码公布!】僵尸追杀玩家 中回复

8楼

2020-08-18T19:16:41 点赞:0

【代码岛3.0代码公布!】僵尸追杀玩家 中回复

9楼

2020-08-18T19:16:49 点赞:0

【代码岛3.0代码公布!】僵尸追杀玩家 中回复

10楼

2020-08-18T19:16:54 点赞:0

【举报】真不知道有什么可说的 中回复

emotion_编程猫_冷漠

2020-08-18T19:21:40 点赞:0

【代码岛3.0代码公布!】僵尸追杀玩家 中回复

/* 本代码实现的功能:
1. 僵尸追杀玩家, 并会对玩家造成伤害
2. 玩家可以点击僵尸进行反击
3. 玩家喵三秒后在空中随机的地点复活
使用说明:
请先在模型库中搜索一个叫做“僵尸"的模型,并放进地图里!不然会出错
*/
const MeshScale = [0.0625,0.0625,0.0625]
fun ction spawn() {//把生成僵尸的代码封装成函数
    const e = world.createEntity({
        mesh:'mesh/僵尸.vb',
        meshScale:MeshScale,
        collides:true, // 开启碰撞
        gravity:true, // 开启重力
        friction:0, // 关闭摩擦力
        maxHp:20,
        hp:20,
        position:[
            64+(Math.random()-0.5) * 60,
            24 + Math.random() * 50,
            64+(Math.random()-0.5) * 60,
        ],
    });
    e.addTag('僵尸');
    e.enableDamage = true;
    e.onVoxelContact(({x,y,z,voxel})=>{
        e.velocity.y = 0.3+Math.random()*0.7//碰到砖块就跳一下
    })
    e.onEntityContact(({other})=>{
        if(other.isPlayer){//僵尸撞到玩家
            other.hurt(40)//对玩家造成伤害
        }
    })
}
for (let i = 0; i < 30; i++) {//开局生成一堆僵尸
    spawn()
}
const Quat = new Box3Quaternion(0,0,0,1)// box引擎默认的旋转朝向
let allPlayers = []//所有玩家
let allZombies = []//所有僵尸
world.onTick(asyn c ({tick}) => {//每秒16个tick
    if(tick%16===0){//每16个tick运行一次, 而不是每个tick都运行,节省性能
        allPlayers = world.querySelectorAll('player')
        allZombies = world.querySelectorAll('.僵尸')
    }
    allZombies.forEach(asyn c (e) => {
        let zomPos = e.position
        if(tick%11===0){//每11个tick运行一次, 而不是每个tick都运行,节省性能
            let target = allPlayers.sort((a,b)=>{//僵尸寻找距离最近的玩家
                return a.position.distan ce(zomPos)-b.position.distan ce(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 //速度0.2~0.5随机
            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.onPlayerJoin(({entity})=>{
    entity.enableDamage = true;
    entity.onDie(asyn c()=>{
        world.say(`${entity.player.name} 被袭击身亡, 3秒后复活`)
        await sleep(3000)
        // 空中随机位置复活
        entity.position.x = Math.random()*127
        entity.position.z = Math.random()*127
        entity.position.y = 100
        await sleep(100) // 防止引擎延迟造成复活后受到死前的伤害
        entity.hp = entity.maxHp //恢复满血
    })
})
world.onClick(({entity})=>{
    entity.hurt(10) //被点中的实体会掉血
})

拿走不谢emotion_doge

注意空格emotion_喵喵

2020-08-18T19:44:04 点赞:0