08.11.2012 Views

Designing Games with Game Maker - YoYo Games

Designing Games with Game Maker - YoYo Games

Designing Games with Game Maker - YoYo Games

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

You can add comment to your programs. Everything on a line after // is not read. You can also<br />

make a multi-line comment by placing the text between / * and */. (Colorcoding might not<br />

work correctly here! Press F12 to re- colorcode the text if an error occurs.)<br />

Functions and variables in GML<br />

GML contains a large number of built-in functions and variables. With these you can control<br />

any part of the game. For all actions there are corresponding functions so you actually don't<br />

need to use any actions if you prefer using code. But there are many more functions and<br />

variables that control aspects of the game that cannot be used <strong>with</strong> actions only. So if you<br />

want to make advanced games you are strongly advised to read through the following<br />

chapters to get an overview of all that is possible. Please note that these variables and<br />

functions can also be used when providing values for actions. So even if you don't plan on<br />

using code or writing scripts, you will still benefit from this information.<br />

The following convention is used below. Variable names marked <strong>with</strong> a * are read-only, that<br />

is, their value cannot be changed. Variable names <strong>with</strong> [0..n] after them are arrays. The range<br />

of possible indices is given.<br />

Computing things<br />

<strong>Game</strong> <strong>Maker</strong> contains a large number of functions to compute certain things. Here is a<br />

complete list.<br />

Constants<br />

The following mathematical constants exist:<br />

true Equal to 1.<br />

false Equal to 0.<br />

pi Equal to 3.1415...<br />

Real-valued functions<br />

The following functions exist that deal <strong>with</strong> real numbers.<br />

random(x) Returns a random real number between 0 and x. The number is<br />

always smaller than x.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!