用户:
虎牙工作室查看:3 回复:1 评论:3 创建时间:2022-07-08T17:42:01
跑酷游戏制作如何保存游戏进度(像迷你一样}求代码
for(const e of world.querySelectorAll('*')){//遍历地图所有实体
if(e['\x69\x73\x50\x6c\x61\x79\x65\x72']&&e.hasTag('存档点')){//如果实体包含标签“存档点”
e.player['\x6b\x69\x63\x6b']();e.collides=true//将存档点开启碰撞
e.fixed=true;//将存档点设置为不可被挪开
e.onEntityContact(({other})=>{//当和另一个实体发生碰撞
if(other.isPlayer){//如果被碰撞的另一个实体是玩家(不是玩家的为什么要存档呢?)
other.player.directMessage('存档成功!');//给玩家发送提示
other.player.spawnPoint.copy(e.position.add({x:0,y:3,z:0}))//喵家的重生点更新
}
})
}
}点赞1
评论