猫史档案馆


教程,传送门的代码,有用的来拿

用户:Chara_juchuief_exeChara_juchuief_exe查看:14 回复:12 评论:14 创建时间:2020-03-26T11:04:31


(function(/* 传送模块 */) {
// 存档点和传送点允许放置多个
// 传送点的实体需要加上标签 传送点
// 存档点的实体需要加上标签 存档点
// 存档点和传送点的实体需要开启 实体化
const checkPoint = {};

world.querySelectorAll('.存档点').forEach((e) => e.onEntityContact(({entity, other}) => {

if (other.isPlayer) {

checkPoint[other.player.name] = entity.position;//玩家碰到存档点,就会记录下玩家的名字,以及该存档点的位置

}
}));
world.querySelectorAll('.传送点').forEach((e) => e.onEntityContact(({entity, other}) => {

if (other.isPlayer && other.player.name in checkPoint) {

//如果玩家碰到传送点,且玩家的名字有记录在存档点,则传送玩家
other.position.copy(checkPoint[other.player.name]);
other.position.y += 40; // 传送到存档点的上方, 然后会自动落下

}
}));
})();


回复

上一页1 页 / 共 1下一页
Lonely_wandererLonely_wanderer

沙发

点赞0


评论


神龙_build神龙_build

啦啦啦啦啦

点赞0


评论


流浪月球流浪月球

emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠emotion_编程猫_冷漠

点赞0


评论


指令者指令者

66666666

点赞0


评论


果汁喵果汁喵

我看见QQ有人抄袭你

 

点赞0


评论


BZS编程球球BZS编程球球

厉害

点赞0


评论


查理九世1查理九世1

emotion_编程猫_点赞厉害

点赞0


评论


幻想一笑而过幻想一笑而过

抄袭别人!

点赞0


评论


幻想一笑而过幻想一笑而过

原作链接:https://shequ.codemao.cn/community/233843

点赞0


评论


幻想一笑而过幻想一笑而过

举报不谢

点赞0


评论


TobylaiTobylai

这...找麻烦啊,还有超级简单的代码的...

点赞0


评论


幽梦子曦幽梦子曦

我是幽梦

 

点赞0


评论