GML Overview: Functions

A function has the form of a function name, followed by zero or more arguments between brackets, separated by commas.

(, ,...) There are two types of functions. First of all, there is a huge collection of built-in functions, to control all aspects of your game. Secondly, any script you define in your game can be used as a function.

Note that for a function without arguments you still need to use '' at the end. Some functions return values and can be used in expressions. Others simply execute commands.

In order to use a function's return value as the left-hand side of an assignment, you must surround the function in parentheses. For example, you cannot write instance_nearest(x,y,obj).speed = 0. Instead you must write (instance_nearest(x,y,obj)).speed = 0.

Previous: Control Statements

Next: Scripts

Back To GML For Non-Programmers