• 首页
  • 动态
  • 案例
  • 引擎社区
  • API
  • 文档
  • 示例
  • 引擎下载

大约有 3 项符合查询结果, 库内数据总量为 30,724 项。 (搜索耗时: 0.0012 秒)

1. 输入设备-摇一摇 [ 100%]

...nction startShake() { Shake.instance.start(5, 500); Shake.instance.on(Laya.Event.CHANGE, this, onShake); console.text = '开始接收设备摇动\n'; } function onShake() { shakeCount++; console.text += "设备摇晃了" + shakeCount + "次\n"; if (shakeCount >= 3) { Shake.instance.stop(); console.t...

来源: Laya_示例 发布时间: 20240930

2. 输入设备-指南针 [ 88%]

...er = Laya.Browser; var Handler = Laya.Handler; var WebGL = Laya.WebGL; var Event = Laya.Event; var compassImgPath = "../../res/inputDevice/kd.png"; var compassImg; var degreesText; var directionIndicator; var firstTime = true; (function() { Laya.init(700, 1024, WebGL); Laya.stage.scaleMode = Stage.S...

来源: Laya_示例 发布时间: 20240930

3. 输入设备-贪吃蛇(重力感应) [ 85%]

...化蛇 initSnake(); // 监视加速器状态 Accelerator.instance.on(Laya.Event.CHANGE, this, monitorAccelerator); // 游戏循环 Laya.timer.frameLoop(1, this, animate); // 食物生产 Laya.timer.loop(3000, this, produceFood); // 游戏开始时有一个食物 produceFood(); })() function initSnak...

来源: Laya_示例 发布时间: 20240930