ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
A code block consists of a set of instructions, called statements, that are then interpreted by GameMaker Studio 2 and used to make something happen within your game. That "something" can be as simple as adding 2 and 2 to get 4, or as complex as making an enemy run away when their health gets below a certain value. The actual structure of the program can vary greatly, depending on the functions it uses, but broken down to basics it just looks like this: ~~~ <statement>; <statement>; ... ~~~ Statements should be separated with a ';' symbol to prevent errors with variable declarations and to keep your code clean and tidy, and can consist of variable declarations, expressions and calls to specific functions or scripts. Here is a more visual representation of how a code block can look, this time created as a script in the GameMaker Studio 2 Script Editor: 一个代码块是由几个单句组成的,每个单句之间需要适用“;”做分割。 单句的数量可多可少,取决于模块的功能作用大小,或者说在游戏里面产生的效果大小。例如: ![](https://box.kancloud.cn/13eca56d8e944c6203c09cbe2273f1ca_554x367.png) There are a number of different types of statements and functions, which are discussed at length in subsequent sections of the manual. 以上几种不同类型的代码和函数,将在本手册的后续章节中详细讨论。