Sample for English (en)Chinese (China) (zh-CN) in MDN_Web_Docs vv2023-09-25

This sample shows 31 sentences.

Back to corpus
Sentences
1–10 / 31
en

{ { GamesSidebar } }

zh-CN

{ { GamesSidebar } }

en

Some games drive this cycle by user input .

Imagine that you are developing a “ find the differences between these two similar pictures ” -type game .

zh-CN

本文 从 技术 角度 分析 了 一般 电子 游戏 的 结构 和 工作 流程 , 就此 介绍 主 循环 是 如何 运行 的 。

en

The game loop is advanced by the user ’ s input and sleeps until they provide it .

This is more of a turn-based approach that doesn ’ t demand a constant update every frame , only when the player reacts .

zh-CN

它 有助 于 初学者 了解 在 现代 游戏 开发 领域 构 建 游戏 时 需要 什么 , 以及 如何 将 JavaScript 这样 的 Web 标准 工具 作为 自己 的 工具 使用 。

en

It might require both input and simulated time .

It might even loop based on something else entirely .

zh-CN

游戏 开发 经验 丰富 但 不 熟悉 Web 开发 的 开发 者 也能 从中 受益 。

en

Of course , your game will only be as optimized as you make it .

zh-CN

呈现 、 接收 、 解释 、 计算 、 重复

en

JavaScript works best with events and callback functions .

Modern browsers strive to call methods right as they are needed and idle ( or do their other tasks ) in the gaps .

It is an excellent idea to attach your code to the moments that are appropriate for them .

zh-CN

所有电子游戏的目标都是向用户 呈现 一个场景 , 接收 他们的输入 , 将这些输入信号 解释 为动作 , 并 计算 出 由 这些 动作 产生 的 新 场景 。

en

A callback function must be passed in to it when it is called .

That callback function will be executed at a suitable time before the next repaint .

zh-CN

游戏 不断地 循环 遍 历 , 一遍 又 一遍 , 直到 遇到 某些 终止 条件 ( 比如 赢 、 输 或者 退出 睡觉 ) 。

en

Here is an example of a simple main loop :

window . main = ( ) = > {

window . requestAnimationFrame ( main ) ;

zh-CN

毫不 奇怪 , 这种 模式 与 游戏 引擎 的 编 程 方式 相 呼应 。

en

That is not by accident and it is considered best practice .

zh-CN

具体 情况 取决 于 游戏 本身 。

en

The above chunk of code has two statements .

zh-CN

一些游戏通过 用户 输入 来 驱动 这个 循环 。