Loading...
Loading...
Compare original and translation side by side
requestAnimationFramerequestAnimationFrame<canvas>requestAnimationFrame<canvas>requestAnimationFrameassets/| Template | Description |
|---|---|
| 2D Breakout-style game with pure JavaScript |
| Maze game with device orientation controls |
| Platformer game using Phaser framework |
| Game base template repository structure |
| Simple 2D platformer engine with collisions |
assets/| 模板 | 描述 |
|---|---|
| 使用纯JavaScript开发的2D打砖块类游戏 |
| 支持设备方向控制的迷宫游戏 |
| 使用Phaser框架开发的平台游戏 |
| 游戏基础模板仓库结构 |
| 带有碰撞检测的简单2D平台游戏引擎 |
references/| Reference | Topics Covered |
|---|---|
| Game development introduction and anatomy |
| Canvas, WebGL, Web Audio, Gamepad, and other web APIs |
| Collision detection, tilemaps, async scripts, audio |
| 3D theory, frameworks, shaders, WebXR |
| Touch, keyboard, mouse, and gamepad controls |
| Distribution, promotion, and monetization |
| Raycasting, collision, physics, vector math |
| Game development glossary |
| Core design principles for game engines |
references/| 参考文档 | 涵盖主题 |
|---|---|
| 游戏开发入门与结构解析 |
| Canvas、WebGL、Web Audio、Gamepad及其他网页API |
| 碰撞检测、瓦片地图、异步脚本、音频处理 |
| 3D理论、框架、着色器、WebXR |
| 触摸、键盘、鼠标和游戏手柄控制 |
| 分发、推广与商业化 |
| 光线投射、碰撞检测、物理效果、向量数学 |
| 游戏开发术语表 |
| 游戏引擎核心设计原则 |
| Issue | Solution |
|---|---|
| Canvas is blank | Check that you are calling drawing methods after getting the context and inside the game loop |
| Game runs at different speeds | Use delta time in update calculations instead of fixed values |
| Collision detection is inconsistent | Use continuous collision detection or reduce time steps for fast-moving objects |
| Audio does not play | Browsers require user interaction before playing audio; trigger playback from a click handler |
| Performance is poor | Profile with browser dev tools, reduce draw calls, use object pooling, and optimize asset sizes |
| Touch controls are unresponsive | Prevent default touch behavior and handle touch events separately from mouse events |
| WebGL context lost | Handle the |
| 问题 | 解决方案 |
|---|---|
| Canvas显示空白 | 检查是否在获取上下文后且在游戏循环内调用绘图方法 |
| 游戏运行速度不一致 | 在更新计算中使用增量时间而非固定值 |
| 碰撞检测不一致 | 使用连续碰撞检测或减少快速移动对象的时间步长 |
| 音频无法播放 | 浏览器要求用户交互后才能播放音频;从点击处理程序触发播放 |
| 性能不佳 | 使用浏览器开发者工具分析性能,减少绘制调用,使用对象池,并优化资源大小 |
| 触摸控件无响应 | 阻止默认触摸行为,并将触摸事件与鼠标事件分开处理 |
| WebGL上下文丢失 | 处理 |