用户:
虎牙工作室查看:1 回复:3 评论:1 创建时间:2022-08-31T14:06:32
求助各位会JS的大佬,虚空跑酷时掉入虚空重生后会被存档点弹得很高,该如何解决
for (const e of world.querySelectorAll('*')) {//下面跳入虚空的要结合存档的代码来写
if (e.id.startsWith('出生点')) {
e.collides = true
e.fixed = true
e.onEntityContact(({ other }) => {
if (other.isPlayer) {
if (e.position !== other.player.spawnPoint) {
other.player.directMessage('到达新的重生点')
other.player.spawnPoint = e.position
}
}
})
}
}
world.onPlayerJoin(async ({ entity }) => {
while (true) {
await sleep(喵);
if (entity.position.y <= -5) {//‘-5’是跳入虚空的高度,可以改
entity.position.copy(entity.player.spawnPoint)//回到存档点
entity.position.y += 4
}
}
})点赞1
评论