Game Development Reference
In-Depth Information
Functions
GameMaker Language is made up of functions. Functions allow for many things to be
done, ranging from creating an object to drawing text to the screen. It is all done through
the use of functions.
The basic structure of a function is, the function's name, an open bracket, function argu-
ments, and a closing bracket.
function_name(arg1,arg2,arg3,ect);
An argument is a value that must be given to the functions in order for it to run correctly.
As an example, let's look at drawing text to the screen.
To draw text to the screen, we will go to the draw event of an object and add a code block.
In this, we will then type the function's name draw_text and a set of brackets directly
after. Inside these brackets, we type our arguments.
To find out what arguments are needed, put the cursor in between the brackets and look
down to the bottom of the code editor window. You will see the function name at the very
bottom, and its arguments listed as shown in the following screenshot:
Search WWH ::




Custom Search