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

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

using the file selector. Note that when testing a game you are creating the<br />

program and working directory will be different. In that case the working<br />

directory is the place where the editable version is stored while the program<br />

directory is a temporary directory for testing.<br />

temp_directory* Temporary directory created for the game. (Not including<br />

the final backslash.) You can store temporary files here. They will be removed<br />

at the end of the game.<br />

In certain situations you might want to give players the possibility of providing command line<br />

arguments to the game they are running (for example to create cheats or special modes). To<br />

get these arguments you can use the following two routines.<br />

parameter_count() Returns the number of command-line parameters. The<br />

actual parameters can be retrieved <strong>with</strong> the following function.<br />

parameter_string(n) Returns command-line parameters n. The first<br />

parameter has index 1. The last one has index parameter_count(). Index 0 is<br />

a special one. It is the filename of the game executable (including the path).<br />

You can read the value of environment variables using the following function:<br />

Registry<br />

environment_get_variable(name) Returns the value (a string) of the<br />

environment variable <strong>with</strong> the given name.<br />

If you want to store a small amount of information between runs of the game there is a<br />

simpler mechanism than using a file. You can use the registry. The registry is a large database<br />

that Windows maintains to keep track of all sorts of settings for programs. An entry has a<br />

name, and a value. You can use both string and real values. The following functions exist:<br />

registry_write_string(name,str) Creates an entry in the registry <strong>with</strong><br />

the given name and string value.<br />

registry_write_real(name,x) Creates an entry in the registry <strong>with</strong> the<br />

given name and real value.<br />

registry_read_string(name) Returns the string that the given name<br />

holds. (The name must exist. Otherwise an empty string is returned.)<br />

registry_read_real(name) Returns the real value that the given name

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

Saved successfully!

Ooh no, something went wrong!