用户:
snov查看:1 回复:5 评论:1 创建时间:2022-11-25T12:23:27
world.addCollisionFilter('player', 'player');
for (const e of world.querySelectorAll('*')) {//遍历所有实体
if (e.id.startsWith('存档点')) {//如果当前实体名左边部分刚好是"存档点", 比如 存档点-1 存档点-2...
e.collides = true //开启碰撞
e.fixed = true //固定实体不被推移
e.onEntityContact(async ({ other, entity }) => { //每当存档点碰到另一个实体
if (other.isPlayer) { //另一个实体是玩家
if (e.position !== other.player.spawnPoint) { // 检测当前存档点是否玩家重生点, 避免反复在同一个存档点做多余的保存
other.player.directMessage('存档成功,离终点又近了一步,加油!') // 给玩家发消息
other.player.spawnPoint.set(e.position.x, e.position.y + 3, e.position.z)// 喵家重生点坐标设置成存档点的坐标
entity.particleRate = 550//粒子生成速率
entity.particleLifetime = 2//粒子存活时间为1秒
entity.particleColor = ColorList[0] //粒子的颜色列表
entity.particleAcceleration = [0, 10 * 1, 0]
entity.particleLimit = 1000
await sleep(1000)
entity.particleRate = 0
}
}
})
}
}