用户:
努力学习的包酱查看:2 回复:2 评论:2 创建时间:2023-01-16T08:56:44
az...就是做了个游戏,每次取前三并会world.say玩家xxx 是第几 )))
呵呵0486//直接打的 没测试过()
const finish = world.querySelector('#模型名字')//查找实体
finish.num = 0//被碰撞次数
finish.onEntityContact(async({other})=>{//触碰
if(other.isPlayer && !other.touch) {//判断是否是玩家&玩家又没有触碰过
other.touch = true//防止玩家多次触碰
finish.num += 1//实体被碰撞次数+1
if(finish.num <= 3/*这里是前多少名世界广播*/) {
world.say(`${other.player.name}第${finish.num}个到达终点!`)//世界广播
}
}
})
//重置
function reset() {
finish.num = 0
world.querySelectorAll('player').forEach((x)=>{x.touch = false})
}
//要重置的时候就调用reset函数就好了
点赞0
评论