用户:
神岛吉吉喵查看:267 回复:64 评论:267 创建时间:2021-03-28T12:04:20

号外号外
挑战32创作节今天下午五点结束
目前倒计时5个小时
各位“肝”帝加油冲刺!
进入正题:千呼万唤的存档点教程来咯
再也不会跑酷游戏虐到了!

https://www.bilibili.com/video/BV17f4y1x7qB
for (const e of world.querySelectorAll('*')) {//遍历所有实体
if (e.id.startsWith('存档点')) {//如果当前实体名左边部分刚好是"存档点", 比如 存档点-1 存档点-2...
e.collides = true //开启碰撞
e.fixed = true //固定实体不被推移
e.meshScale = e.meshScale.scale(2) //放大2倍
e.onEntityContact(({ other }) => { //每当存档点碰到另一个实体
if (other.isPlayer) { //另一个实体是玩家
if (e.position !== other.player.spawnPoint) { // 检测当前存档点是否玩家重生点, 避免反复在同一个存档点做多余的保存
other.player.directMessage('到达新的重生点') // 给玩家发消息
other.player.spawnPoint = e.position // 喵家重生点坐标设置成存档点的坐标
}
}
})
}
}
world.onPlayerJoin(({ entity }) => {
entity.onFluidEnter(() => {//当玩家掉到水里
entity.position.copy(entity.player.spawnPoint)
entity.position.y += 4
})
})
开发API文档:https://docs.box3.codemao.cn/
加入代码岛3.0官方内测Q喵
下面的二维码会扫出来什么呢?( =•ω•= )m
