通过 GAN 智能魔方操控网页小游戏的交互式项目
本项目基于 gan-cube-sample 进行修改,核心使用了 gan-web-bluetooth 库来实现 GAN 智能魔方与 Web 的蓝牙连接和交互
- 自动扫描选择连接 GAN 智能魔方
- 使用魔方转动控制网页游戏
- 支持多款网页小游戏(2048、俄罗斯方块)
- 确保你的浏览器支持并启用 Web Bluetooth API(推荐使用 Chrome/Edge 浏览器)
- 连接你的 GAN 智能魔方
- 转动魔方即可开始游戏
注意:
- 浏览器中启用 Web Bluetooth API 的方法:
- Chrome:
chrome://flags/#enable-experimental-web-platform-features- Edge:
edge://flags/#enable-experimental-web-platform-features
- 测试发现若为移动端,可能需要预先获取魔方蓝牙的MAC地址进行连接
获取MAC地址的方法如下:
- Chrome:
chrome://bluetooth-internals/#devices- Edge:
edge://bluetooth-internals/#devices
- 当从俄罗斯方块切回2048时,会出现交互无反应的情况,需要刷新网页重新连接魔方
本项目中的小游戏均来源于开源项目,并根据需求进行了适当修改,以支持通过 GAN 智能魔方进行操控
- gan-web-bluetooth - GAN 智能魔方蓝牙通信库
- gan-cube-sample - GAN 智能魔方蓝牙通信示例
- 2048 - 2048 原仓库
- vue-tetris - 俄罗斯方块原仓库