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.

oom.<br />

room_tile_add(ind,back,left,top,width,height,x,y,depth) Adds<br />

a new tile to the room at the indicate position. It returns the index of the tile.<br />

back is the background from which the tile is taken. left, top, width and height<br />

indicate the part of the background that forms the tile. x,y is the position of<br />

the tile in the room and depth is the depth of the tile.<br />

room_tile_add_ext(ind,back,left,top,width,height,x,y,depth,<br />

xscale,yscale,alpha) Same as the previous routine but this time you can<br />

also specify a scaling factor in x and y direction and an alpha transparency for<br />

the tile.<br />

room_tile_clear(ind) Removes all tiles from the indicated room.<br />

Files, registry, and executing programs<br />

In more advanced games you probably want to read data from a file that you provide <strong>with</strong> the<br />

game. Or you might want to store information between runs of the game. And in some<br />

situations you might need to execute external programs.<br />

Files<br />

It is useful to use external files in games. For example, you could make a file that describes at<br />

what moments certain things should happen. Also you probably want to save information for<br />

the next time the game is run (for example, the current room). The following functions exist to<br />

read and write data in text files:<br />

file_text_open_read(fname) Opens the file <strong>with</strong> the indicated name for<br />

reading. The function returns the id of the file that must be used in the other<br />

functions. You can open multiple files at the same time (32 max). Don't forget<br />

to close them once you are finished <strong>with</strong> them.<br />

file_text_open_write(fname) Opens the indicated file for writing,<br />

creating it if it does not exist. The function returns the id of the file that must<br />

be used in the other functions.<br />

file_text_open_append(fname) Opens the indicated file for appending<br />

data at the end, creating it if it does not exist. The function returns the id of<br />

the file that must be used in the other functions.<br />

file_text_close(fileid) Closes the file <strong>with</strong> the given file id.

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

Saved successfully!

Ooh no, something went wrong!